Gridview and Dynamically making a hyperlink....
Posted on 2011-10-12
I populate a dataset and bind it to a gridview...
grd1.DataSource = dsXXX
Then within the RowDataBound event I try to make a field within a specific column a hyperlink by using the following code....
Dim hLink As HyperLink = TryCast(e.Row.Cells(2).Controls(0), HyperLink)
hLink.NavigateUrl = "Profile.aspx?q=" + e.Row.Cells(2).Text
Unfortunatly I receive the following error:
"Specified argument was out of the range of valid values. Parameter name: index"
Can anyone help me make a hyperlink when dynamically binding a dataset?