I have a Master/Slave GrisViews or some say Parent/Child GridViews.
i want to set my button visible=false in the child gridview if data is not exist.
i try this:
Protected Sub gv_child_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='#FFC080';")
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='';")
Dim lblitemid As Label = CType(e.Row.Cells(1).Controls(1), Label)
Dim lblphoto As Label = CType(e.Row.Cells(11).Controls(1), Label)
Dim btndetails As ImageButton = CType(e.Row.Cells(14).Controls(1), ImageButton)
Dim lblrem As Label = CType(e.Row.Cells(10).Controls(1), Label)
Dim btncomment As ImageButton = CType(e.Row.Cells(10).Controls(3), ImageButton)
Dim btnattachment As ImageButton = CType(e.Row.Cells(13).Controls(1), ImageButton)
Dim btnedit As ImageButton = CType(e.Row.Cells(15).Controls(1), ImageButton)
Dim btnview As ImageButton = CType(e.Row.Cells(0).Controls(1), ImageButton)
Dim imgphoto As System.Web.UI.DataBoundLiteralControl = CType(e.Row.Cells(12).Controls(0), System.Web.UI.DataBoundLiteralControl)
If lblitemid.Text = "" Then
btndetails.Visible = False
btncomment.Visible = False
btnattachment.Visible = False
btnedit.Visible = False
btnview.Visible = False
imgphoto.Visible = False
ElseIf lblrem.Text = "" Then
btncomment.Visible = False
End If
If lblrem.Text.Length > 50 Then
lblrem.Text = lblrem.Text.Substring(0, 50) & "..."
End If
End If
End Sub
but it does not working. the button is still there. can anyone help me?