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.....
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.....