Submit Button passing values to another form

Posted on 2006-05-05
Medium Priority
Last Modified: 2010-04-16
Hi All,

I am new to .NET and i need some help.

I have a form(.aspx/.aspx.cs)  called Search it has 3 text boxes on it.
I want to pass the values of those textboxes to another form called Report_Viewer (.aspx/.aspxcs) via the SUBMIT Button.  

I am not sure if it would be easier to write the code using ASP OR C#.  BUt if anyone knows how i can accmplish this could you please help me.  I have been working on this issue for a few days now and time is running out for me to get this completed.


Question by:GoldenJag

Assisted Solution

pauljk1619 earned 400 total points
ID: 16615447
You can easily transfer the values to another page on the same server and preserve the data from the form by using...

Server.Transfer("WebForm2.aspx", True)

in your Click Event.

It won't appear to the end user as the page has changed, but the control to process the information will be moved to the other page.
LVL 52

Accepted Solution

Carl Tawn earned 1600 total points
ID: 16615501
If you are using .Net 2.0 then you can just set the action of the form to a different page.

Alternatively you can use Server.Transfer to pass control to your second page. If the textboxes are public in your first form you can transfer to the second page with:


Then in page2 you can get access to the values with something like:

    Form1 f = (Form1)Context.Handler;

You can now use "f" to access the textboxes and their values posted from Page1.

Author Comment

ID: 16615592
Thanks for your help.  Carl Tawn thanks for being detailed about how to access the values from the other page.

You guys are great!!

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses
Course of the Month16 days, 8 hours left to enroll

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question