Not sure if this is possible, but I have a column in the grid called SSN. In code behind, I'd like to find the row where the SSN column = "000112222" to get a handle to the row so that I can then grab other column data. I would like to be able to do it by column name (i.e. SSN) versus column index as my grid has dynamic columns. Any suggestions would be greatly appreciated!
Works! Much thanks!
Try following syntax.
(1) To set Data Key Field:
grid1.DataSource = yourDataTable;
grid1.DataKeyField = "SSN";
grid1.DataBind();
(2) To search row using data key field
UltraGridRow row = grid1.Rows.FromDataKey(new string[]{"000112222"});
Let me know this works for you.
This looks like it should be able to handle it. I just can't see anywhere in there support documentation how to create the datakey that is passed in as the paramter for the FromDataKey. I know I would need to create it for the SSN column, I just don't know the syntax.
Thanks for the info! I tried messing with the FromKey and didn't get far before. Let me revisit. I'll let you know.
Hi,
I think this is possible using FromDataKey() function if you have set SSN as data key column.
You could use grid.Rows.FromDataKey() function to get the required row.
Check help for more detail.
I hope this would help you.
Greetings