help please or any coment please

G

Guest

hi friends,
I have a couple of questions.

I have a datagrid and a hyperlink column 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
object.

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
Else
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? selecteditem.index for datagrid doesnt work this way?
AND How can I do what I want?

please help.....
 
C

Cor Ligthert [MVP]

Pokemon,

I see a lot of code but I am curious how you do this.
I want is when I click
the hyperlink, go to another page with the value which is in the second
cell
of the row.

For that I see no code.

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top