Object reference not set to an instance of an object error.

srithil

Newcomer
Joined
Apr 30, 2004
Messages
21
Hai,
I am trying to transfer some values from page1 to page2.In page1 i am sending the values through a button click event and receiving the values in page2 on my pageload event.I get the error object reference not set to an instance of an object.anybody pls help.
thanks.


page1.aspx

'on button clicked it has to go to page2.aspx
If (p_daily.Checked) Then
Context.Items.Add("site", p_siteid.SelectedItem.Value())
Context.Items.Add("daily", p_daily1.Text())
Server.Transfer("page2.aspx")
End If
If (p_from.Checked) Then
Context.Items.Add("site", p_siteid.SelectedItem.Value())
Context.Items.Add("from", p_from1.Text())
Context.Items.Add("to", p_to.Text())
Server.Transfer("page2.aspx")
End If


In page2.aspx i am receiving the values in my pageload event.
but i am getting the error Object reference not set to an instance of an object.

Page2.aspx.



If Not Page.IsPostBack Then

Dim s, s1, s2, s3, s4, s5, strscript As String
s = ""
s1 = ""
s2 = ""
s3 = ""
s4 = ""
s = context.Items("daily")
s1 = context.Items("site")
s2 = context.Items("from")
s3 = context.Items("to")


If s.Length <> 0 Then


Dim myConnection As New SqlClient.SqlConnection
myConnection.ConnectionString = tq()

'database connections and query goes here.............

End If



If s2.Length <> 0 And s3.Length <> 0 Then


Dim myConnection As New SqlClient.SqlConnection
myConnection.ConnectionString = tq()

'database connections goes here....................

End If

end if
 
Back
Top