Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 how to do postback using masterpage?

Author  Topic 

micweng
Starting Member

3 Posts

Posted - 2006-12-06 : 08:56:46
hi..

i want to take a value from a text box from page1 into a label in page2. i use the code below but it shows me error "Object reference not set to an instance of an object." The method i use below can be done with normal web forms but the error occurs when i use in masterpage.

protected void Page_Load(object sender, EventArgs e)

{ Label1.Text = Request["Textbox1"].ToString();

}

Please help...Thanks!

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2006-12-06 : 09:30:49
where are you calling it?
you must use Page.FindControl function



Go with the flow & have fun! Else fight the flow
blog thingie: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

micweng
Starting Member

3 Posts

Posted - 2006-12-06 : 09:41:07
hi..
can you give me an example on how to use Page.FindControl function?

Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2006-12-06 : 09:57:29
http://msdn2.microsoft.com/en-us/library/31hxzsdw.aspx



Go with the flow & have fun! Else fight the flow
blog thingie: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

micweng
Starting Member

3 Posts

Posted - 2006-12-07 : 12:29:03
hi..
i've tried the Page.FindControl function. but it still doesn't work.
it does not shows any errors anymore but it doesn't show anything in the label.
thanks for helping!
Go to Top of Page
   

- Advertisement -