Submit Button passing values to another form

Posted on 2006-05-05
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
    LVL 7

    Assisted Solution

    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

    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

    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

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Article by: Ivo
    Anonymous Types in C# by Ivo Stoykov Anonymous Types are useful when  we do not need to follow usual work-flow -- creating object of some type, assign some read-only values and then doing something with them. Instead we can encapsulate this read…
    This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    729 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

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now