Skip to main content
Home Forums Silverlight Programming Silverlight Controls and Silverlight Toolkit How can i know the exact location of cell(which column and which row) selected in datagrid?
1 replies. Latest Post by Ken Tucker on October 29, 2008.
(0)
spiderma...
Member
225 points
282 Posts
10-28-2008 9:10 PM |
Hi, all
I have a datagrid and a textbox, when i select one cell in datagrid, the cell of message(Row[?] Column[?]) will be displayed in textbox .
How can I get the row and col message in datagrid?
Thanks....
ken tucker
All-Star
16234 points
2,473 Posts
10-29-2008 6:27 PM |
Try something like this.
Private Sub dgCategories_CurrentCellChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles dgCategories.CurrentCellChanged txtHere.Text = String.Format("Row {0}, Col {1}", dgCategories.SelectedIndex, dgCategories.CurrentColumn.DisplayIndex) End Sub Private Sub dgCategories_SelectionChanged(ByVal sender As Object, ByVal e As System.Windows.Controls.SelectionChangedEventArgs) Handles dgCategories.SelectionChanged txtHere.Text = String.Format("Row {0}, Col {1}", dgCategories.SelectedIndex, dgCategories.CurrentColumn.DisplayIndex) End Sub