Jump to content

How to pass a value typed in textbox of one asp.net page to another?

i want to pass the value typed in textbox of page 1 to a variable in page 2 for some calculation how can this be done? i have tried the code below but it gives me an error saying i cant access that textbox because of its protection levels.i went to change its access modifier from its properties but an option like that was not available.

 

//me trying to access textbox1 of aspx page 1 from page 2
Form f1 = new Form1();
String x = f1.TextBox1;

 

Link to comment
Share on other sites

Link to post
Share on other sites

There are multiple options you can use to share information between pages. Here are some that come to mind.

  • Submit a form
  • Add the value to the url as a query string
  • Persist the data somewhere the page can access
    • Database
    • Cookie
    • Session
  • Use websockets

 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×