How to find a row in a Datagrid
I have 2 grids side by side and when I run a function to expand a row in one, I need to expand the same row in the other grid. So I have the row id from the first but just dont know how to find that row in the second. Here is my code for the expand in the first grid.
Code:
Private Sub Dg_ItemCommand(ByVal source As System.Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles DataGrid1.ItemCommand
Select Case e.CommandName
Case "Expand"
Dim rowid As Integer
rowid = DataGrid1.DataKeys.Item(e.Item.ItemIndex)
Dim ExpandedContent As PlaceHolder = e.Item.Cells(DataGrid1.Columns.Count - 1).FindControl("ExpandedContent")
ExpandedContent.Visible = Not ExpandedContent.Visible
Dim btnExpand As ImageButton = e.Item.Cells(0).FindControl("btnExpand")
If btnExpand.ImageUrl = "~/Images/Plus.gif" Then
btnExpand.ImageUrl = "~/Images/Minus.gif"
Else
btnExpand.ImageUrl = "~/Images/Plus.gif"
End If
End Select
End Sub