in my website , page1 contain 100 txt boxes,1 btn. when I click the button I wish u navigate to page2 with all 100 txt boxes information? i.e., How can I maintain all these 100 txt boxes information from one page to another page when I navigate?
Siva Krishna Pittu
u can achieve this as follows
request object supports a method called form().i.e request.form();
with this method u can access the controlls in previous page.ie u r navigated to page2.aspx when u click on a button in page1.aspx and page1.aspx has a textbox with id 'txt1'.now u can access value of txt1 in page2.aspx as follows
string str;
str=Request.Form("txt1").Text;
for form() method u have to pass a controls id as a argument.
every webserver control has inherent property called 'viewstate'.viewstate is concept of maintaining controll properties under postback.by default it is enabled unless disabled explicitly.coming your requirement u have a page1.aspx in which u have some text boxes & a button.and u want to navigate to page2.aspx when user clicks on button and u want acess the textbox values from page2.aspx.for that u can follow any one of the below said approaches.
in asp.net 'request' object supports a method called form() i.e request.form().with this method u can acess the controll in previous page.
i.e u have textbox called 'txt1' in page1.aspx & u have button when clicked navigated to page2.aspx.
now in page2.aspx ucan acess txt1 through request.form() method as shown in below.
str=request.form("txt1").text;
this is one approach.
one more aproach u can follow is that, every page is a class.so u can create a object for page1.aspx in page2.aspx.with that object u can acess the controls in it.