By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,333 Members | 1,060 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,333 IT Pros & Developers. It's quick & easy.

datagrid hyperlink help

P: n/a
hi friends,
I have a couple of questions.

I have a datagrid and ahyperlink coulmn on it. all I want is when I click
the hyperlink, go to another page with the value which is in the second cell
of the row.
I tried this but it didnt work

Private Sub HL_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Handles DataGrid1.Unload
Session("info") =
DataGrid1.Items(DataGrid1.SelectedItem.ItemIndex). Cells(1).Text
End Sub
it gives me the error:
System.NullReferenceException: Object reference not set to an instance of an

I assumed that I'm populating the grid after a postback and so the
selecteditem will be null. so I tried this:

If DataGrid1.Items(DataGrid1.SelectedItem.ItemIndex). Cells(1) Is
DBNull.Value Then
Session("info") = 0
Session("info") =
DataGrid1.Items(DataGrid1.SelectedItem.ItemIndex). Cells(1).Text

End If
but it didnt work too..
how can I pass teh nullref error, is there a function like isnull in SQL?
am I all wrong?
AND How can I do what I want?

please help.....
Mar 24 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.