I have a gridview with some data and two hyperlinkfields
I want to make the first hyperlinkfield of the first row not visible
and the second hyperlinkfield of the last row not visible
this what I did till now
Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
Dim x As HyperLink
x = e.Row.Cells(8).Controls(0)
If e.Row.RowIndex = 0 Then
x.Visible = False
End If
If e.Row.RowIndex = GridView1.Rows.Count Then
'x = e.Row.Cells(9).Controls(0)
'x.Visible = False
End If
End If
End Sub
This will work only for the first hyperlinkfield.
Omitting the comments will make the first hyperlinkfield not visible for all rows.
Any help is appreciated.
Thanks in advance.
If the visibility is based on a data value you can use the Visible attribute in the HyperLink object.
You can also use an if statement inside the aspx file to display the HyperLink.