A
AG
I have a gridview with a template column containing an imagebutton to delete
the row.
Under some condition I don't want the row to be deleted, so would like to
remove the button.
In the RowDataBound event, I can find the button, but can't seem to remove
it.
The code below does not throw any exception, but the button is not removed.
Protected Sub gv1_RowDataBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.GridViewRowEventArgs) Handles gvUsers.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
If CriteriaIsMet Then
Dim ibtN As ImageButton =
CType(e.Row.Cells(1).FindControl("ibtnDelete"), ImageButton)
If ibtN IsNot Nothing Then
e.Row.Cells(1).Controls.Remove(ibtN)
End If
End If
End If
End Sub
How can I remove it?
Or must I settle for ibtN.Visible = False.
TIA.
the row.
Under some condition I don't want the row to be deleted, so would like to
remove the button.
In the RowDataBound event, I can find the button, but can't seem to remove
it.
The code below does not throw any exception, but the button is not removed.
Protected Sub gv1_RowDataBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.GridViewRowEventArgs) Handles gvUsers.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
If CriteriaIsMet Then
Dim ibtN As ImageButton =
CType(e.Row.Cells(1).FindControl("ibtnDelete"), ImageButton)
If ibtN IsNot Nothing Then
e.Row.Cells(1).Controls.Remove(ibtN)
End If
End If
End If
End Sub
How can I remove it?
Or must I settle for ibtN.Visible = False.
TIA.