views:

27

answers:

1

Hi,

how can I add a attribute like rel="example_group" to a hyperlink control in a databound gridview?

<asp:HyperLink ID="HyperLink3" runat="server">HyperLink</asp:HyperLink>

Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound
    Dim myImage As HyperLink = CType(e.Row.FindControl("HyperLink3"), HyperLink)
    myImage.Attributes.Add("rel", "example_group")
End Sub

Didn't work. thx for all responce in advance...

A: 
If e.Row.RowType = DataControlRowType.DataRow Then ... End If

... was missing. It's ok now.