Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi,

I want to be able to select a row on my datagrid, but I don't 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 can't 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

Posted

I´m not sure of what you mean by 'when I see the datagrid no row is selected', but if you want to display the selected row you´ve got to open the property builder select Format > Items > Selected Items and change the appearance (Back Color, Font,Fore Color...).

 

Hope this will help.

  • Moderators
Posted

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)

Visit...Bassic Software

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...