Selecting a row in a datagrid

al445843

New member
Joined
Mar 5, 2003
Messages
2
Location
Mexico City
Hi,
I want to be able to select a row on my datagrid, but I dont know what is happening.

First I get a key of the item that should be selected on my grid, and then I try to use that information to select the row, but I cant make it


I have this code in my ItemDataBound event of my datagrid

If dgChartMap.DataKeys(e.Item.ItemIndex) = MyKey Then
dgChartMap.SelectedIndex = e.Item.ItemIndex
End If

So, I debugged it, and in fact I get the SelectedIndex value right, but when I see the datagrid, no row is selected.

Does anybode know what am I doing wrong, or how should I set this in order to run?

Thanks in advance
 
If I understand correctly, you want to highlight a row in the datagrid as though the user clicked (selected) a row. Is this correct?
If so try this.... DataGrid1.Select(yourIntValue)
 
Back
Top