I have 2 web pages. First page has a textbox and a button control.
when I enter test and click on the button , system goes to the second page. And in the second page I want to access the Textbox in the first page. When I try to do this I get the following error.
"Object reference not set to an instance of an object. Following is my code :
Dim txt As New TextBox
' Find the server name on the previous page
txt = CType(Page.PreviousPage.FindControl("TextBox2"), TextBox)
If Not IsNothing(txt) Then
Response.Write(Server.HtmlEncode(txt.Text))
Else
Response.Write("[Name Not available]")
End If
I know I could do this with session, but I want to use the Page.PreviousPage.FindControl. Any help is greatly appreciated.
...
Go to the complete details ...