flybird2810
New member
- Joined
- Jul 7, 2006
- Messages
- 2
- Programming Experience
- 1-3
I've got a problem on Datagrid.
I am using IsSelected to find which rows is selected and get its value.
When I havn't sorted any column in datagrid, DataGrid.IsSelected works normally. However, It does not work after a column is sorted. Is there have any problem or limitation ?
My code is here :
Column 0 is Record_ID and I would like to get the selected ID as follow
For i As Integer = 0 To dt.Rows.Count - 1
If Me.dtg1.IsSelected(i) Then
If Me.dtg1.Item(i, 0) =
Integer.Parse(dt.Rows(i)("Record_ID")) Then
SelectedRowsCount = SelectedRowsCount + 1
If SelectedRowsCount > 1 Then
SelectedRowsStr &= "," & i
Else
SelectedRowsStr = i
End If
End If
Next
Thanks~~
I am using IsSelected to find which rows is selected and get its value.
When I havn't sorted any column in datagrid, DataGrid.IsSelected works normally. However, It does not work after a column is sorted. Is there have any problem or limitation ?
My code is here :
Column 0 is Record_ID and I would like to get the selected ID as follow
For i As Integer = 0 To dt.Rows.Count - 1
If Me.dtg1.IsSelected(i) Then
If Me.dtg1.Item(i, 0) =
Integer.Parse(dt.Rows(i)("Record_ID")) Then
SelectedRowsCount = SelectedRowsCount + 1
If SelectedRowsCount > 1 Then
SelectedRowsStr &= "," & i
Else
SelectedRowsStr = i
End If
End If
Next
Thanks~~