how ASP.NET page gets user input from another ASP.NET page??

Discussion in 'ASP .Net Web Controls' started by Matthew Louden, Nov 22, 2003.

  1. In ASP, if I have asppage.asp for GUI and aspprocess.asp for process
    requests from database.

    In asppage.asp code will be like:
    <form action="aspprocess.asp" method="POST"> GUI CODE </form>

    When the user clicks the submit button on asppage.asp, it will invoke
    aspprocess.asp page

    aspprocess.asp code can get the user input from asppage.asp by doing:
    Request.Form("Control_ID")

    In ASP.NET, if I want to achieve the same goal: if I have aspxpage.aspx for
    GUI and aspxprocess.aspx for process requests from database

    In aspxpage.aspx code will be like:
    <form id="Form1" method="post" action="aspxprocess.aspx" runat="server"> GUI
    CODE </form>

    However, when the user clicks the submit button on aspxpage.aspx, it didn't
    invoke aspxpage.aspx page at all, unless I do the the following:

    Private Sub Submit1_ServerClick(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles Submit1.ServerClick
    Response.Redirect("aspxprocess.aspx")
    End Sub

    But even now I am in aspxprocess.aspx page, how can I get the user input
    from aspxpage.aspx??
    Request.Form("Control_ID") no longer works.

    Please advise!
    Thanks!
     
    Matthew Louden, Nov 22, 2003
    #1
    1. Advertising

  2. Try this?

    http://authors.aspalliance.com/kenc/passval.aspx

    "Matthew Louden" <> wrote in message
    news:...
    > In ASP, if I have asppage.asp for GUI and aspprocess.asp for process
    > requests from database.
    >
    > In asppage.asp code will be like:
    > <form action="aspprocess.asp" method="POST"> GUI CODE </form>
    >
    > When the user clicks the submit button on asppage.asp, it will invoke
    > aspprocess.asp page
    >
    > aspprocess.asp code can get the user input from asppage.asp by doing:
    > Request.Form("Control_ID")
    >
    > In ASP.NET, if I want to achieve the same goal: if I have aspxpage.aspx

    for
    > GUI and aspxprocess.aspx for process requests from database
    >
    > In aspxpage.aspx code will be like:
    > <form id="Form1" method="post" action="aspxprocess.aspx" runat="server">

    GUI
    > CODE </form>
    >
    > However, when the user clicks the submit button on aspxpage.aspx, it

    didn't
    > invoke aspxpage.aspx page at all, unless I do the the following:
    >
    > Private Sub Submit1_ServerClick(ByVal sender As System.Object, ByVal e As
    > System.EventArgs) Handles Submit1.ServerClick
    > Response.Redirect("aspxprocess.aspx")
    > End Sub
    >
    > But even now I am in aspxprocess.aspx page, how can I get the user input
    > from aspxpage.aspx??
    > Request.Form("Control_ID") no longer works.
    >
    > Please advise!
    > Thanks!
    >
    >
     
    Ken Cox [Microsoft MVP], Nov 22, 2003
    #2
    1. Advertising

  3. Setting the form action attribute just isn't the ASP.NET way.

    Of course there are a number of ways to pass values from one page to
    another, such as using the querystring, cookies, session,
    context, saving to a temporary table in the database between each page, etc.
    You'll have to decide which technique is best for your application.
    Here are several good articles on the subject to help you decide.
    http://msdn.microsoft.com/msdnmag/issues/03/04/ASPNETUserState/default.aspx

    http://www.aspalliance.com/kenc/passval.aspx

    http://www.dotnetjunkies.com/tutorials.aspx?tutorialid=600

    http://www.dotnetbips.com/displayarticle.aspx?id=79

    Here's one nice, simple way to pass values from one page to another:

    'Add data to the context object before transferring
    Context.Items("myParameter") = x
    Server.Transfer("WebForm2.aspx")

    Then, in WebForm2.aspx:

    'Grab data from the context property
    Dim x as Integer = CType(Context.Items("myParameter"),Integer)

    --
    I hope this helps,
    Steve C. Orr, MCSD, MVP
    http://Steve.Orr.net
    Hire top-notch developers at http://www.able-consulting.com



    "Matthew Louden" <> wrote in message
    news:...
    > In ASP, if I have asppage.asp for GUI and aspprocess.asp for process
    > requests from database.
    >
    > In asppage.asp code will be like:
    > <form action="aspprocess.asp" method="POST"> GUI CODE </form>
    >
    > When the user clicks the submit button on asppage.asp, it will invoke
    > aspprocess.asp page
    >
    > aspprocess.asp code can get the user input from asppage.asp by doing:
    > Request.Form("Control_ID")
    >
    > In ASP.NET, if I want to achieve the same goal: if I have aspxpage.aspx

    for
    > GUI and aspxprocess.aspx for process requests from database
    >
    > In aspxpage.aspx code will be like:
    > <form id="Form1" method="post" action="aspxprocess.aspx" runat="server">

    GUI
    > CODE </form>
    >
    > However, when the user clicks the submit button on aspxpage.aspx, it

    didn't
    > invoke aspxpage.aspx page at all, unless I do the the following:
    >
    > Private Sub Submit1_ServerClick(ByVal sender As System.Object, ByVal e As
    > System.EventArgs) Handles Submit1.ServerClick
    > Response.Redirect("aspxprocess.aspx")
    > End Sub
    >
    > But even now I am in aspxprocess.aspx page, how can I get the user input
    > from aspxpage.aspx??
    > Request.Form("Control_ID") no longer works.
    >
    > Please advise!
    > Thanks!
    >
    >
     
    Steve C. Orr [MVP, MCSD], Nov 22, 2003
    #3
  4. If you absolutely must allow ASPXPAGE to pass the form
    like classic ASP, turn off PostBack on the page.

    However, as others have noted, in ASP.Net, there are good
    reasons for allowing the postback to happen (e.g. control
    validation), so be sure you've thought it all through
    before you proceed.

    Erik J Sawyer, Webmaster
    Kingsport City Schools

    >-----Original Message-----
    >In ASP, if I have asppage.asp for GUI and aspprocess.asp

    for process
    >requests from database.
    >
    >In asppage.asp code will be like:
    ><form action="aspprocess.asp" method="POST"> GUI CODE

    </form>
    >
    >When the user clicks the submit button on asppage.asp,

    it will invoke
    >aspprocess.asp page
    >
    >aspprocess.asp code can get the user input from

    asppage.asp by doing:
    >Request.Form("Control_ID")
    >
    >In ASP.NET, if I want to achieve the same goal: if I

    have aspxpage.aspx for
    >GUI and aspxprocess.aspx for process requests from

    database
    >
    >In aspxpage.aspx code will be like:
    ><form id="Form1" method="post" action="aspxprocess.aspx"

    runat="server"> GUI
    >CODE </form>
    >
    >However, when the user clicks the submit button on

    aspxpage.aspx, it didn't
    >invoke aspxpage.aspx page at all, unless I do the the

    following:
    >
    >Private Sub Submit1_ServerClick(ByVal sender As

    System.Object, ByVal e As
    >System.EventArgs) Handles Submit1.ServerClick
    > Response.Redirect("aspxprocess.aspx")
    >End Sub
    >
    >But even now I am in aspxprocess.aspx page, how can I

    get the user input
    >from aspxpage.aspx??
    >Request.Form("Control_ID") no longer works.
    >
    >Please advise!
    >Thanks!
     
    Erik J Sawyer, Nov 23, 2003
    #4
  5. Matthew Louden

    Steve Nihan Guest

    Not sure if this is what you're looking for...but... In all of my aspx
    pages that needed processing...I've used codebehind pages to process the
    form. Makes things alot easier, simpler, and faster. Simply tie the submit
    button to a sub which processes the data you're trying to move. It's
    already on the page....so calling the code behind page will just be a matter
    of:

    Dim uEmail as string = Email.Text

    There's just so much to do using that method...and there are quite a few
    books out there already...so I don't want to aggrivate people by writing one
    here....LOL



    "Matthew Louden" <> wrote in message
    news:...
    > In ASP, if I have asppage.asp for GUI and aspprocess.asp for process
    > requests from database.
    >
    > In asppage.asp code will be like:
    > <form action="aspprocess.asp" method="POST"> GUI CODE </form>
    >
    > When the user clicks the submit button on asppage.asp, it will invoke
    > aspprocess.asp page
    >
    > aspprocess.asp code can get the user input from asppage.asp by doing:
    > Request.Form("Control_ID")
    >
    > In ASP.NET, if I want to achieve the same goal: if I have aspxpage.aspx

    for
    > GUI and aspxprocess.aspx for process requests from database
    >
    > In aspxpage.aspx code will be like:
    > <form id="Form1" method="post" action="aspxprocess.aspx" runat="server">

    GUI
    > CODE </form>
    >
    > However, when the user clicks the submit button on aspxpage.aspx, it

    didn't
    > invoke aspxpage.aspx page at all, unless I do the the following:
    >
    > Private Sub Submit1_ServerClick(ByVal sender As System.Object, ByVal e As
    > System.EventArgs) Handles Submit1.ServerClick
    > Response.Redirect("aspxprocess.aspx")
    > End Sub
    >
    > But even now I am in aspxprocess.aspx page, how can I get the user input
    > from aspxpage.aspx??
    > Request.Form("Control_ID") no longer works.
    >
    > Please advise!
    > Thanks!
    >
    >
     
    Steve Nihan, Nov 24, 2003
    #5
  6. In ASP. Net You Can not submit your page to another form. It always post
    back to the same page.

    Here are three links that will help you solove your probelm.

    They are many solutions. But I will tell you one of them. It is called
    QueryString.

    Sub Button1_Click(sender as object, e as EventArgs)
    Response.Redirect("asppage.aspx?name=" & name.Text)
    End Sub

    And in the process page you can call it by

    Sub Page_Load(sender as object, e as EventArgs)
    Request.QueryString("name")
    End Sub

    For more information you can visit.

    http://www.stardeveloper.com/articles/display.html?article=2003061901&page=1
    http://www.dotnetbips.com/displayarticle.aspx?id=79
    http://authors.aspalliance.com/wisemonk/print.aspx?id=AN012522

    Regards,
    Fah@d ;)


    "Matthew Louden" <> wrote in message
    news:...
    > In ASP, if I have asppage.asp for GUI and aspprocess.asp for process
    > requests from database.
    >
    > In asppage.asp code will be like:
    > <form action="aspprocess.asp" method="POST"> GUI CODE </form>
    >
    > When the user clicks the submit button on asppage.asp, it will invoke
    > aspprocess.asp page
    >
    > aspprocess.asp code can get the user input from asppage.asp by doing:
    > Request.Form("Control_ID")
    >
    > In ASP.NET, if I want to achieve the same goal: if I have aspxpage.aspx

    for
    > GUI and aspxprocess.aspx for process requests from database
    >
    > In aspxpage.aspx code will be like:
    > <form id="Form1" method="post" action="aspxprocess.aspx" runat="server">

    GUI
    > CODE </form>
    >
    > However, when the user clicks the submit button on aspxpage.aspx, it

    didn't
    > invoke aspxpage.aspx page at all, unless I do the the following:
    >
    > Private Sub Submit1_ServerClick(ByVal sender As System.Object, ByVal e As
    > System.EventArgs) Handles Submit1.ServerClick
    > Response.Redirect("aspxprocess.aspx")
    > End Sub
    >
    > But even now I am in aspxprocess.aspx page, how can I get the user input
    > from aspxpage.aspx??
    > Request.Form("Control_ID") no longer works.
    >
    > Please advise!
    > Thanks!
    >
    >
     
    Fahad Al Hadhrami, Nov 24, 2003
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matthew Louden
    Replies:
    4
    Views:
    3,117
    Fahad Al Hadhrami
    Nov 24, 2003
  2. Stefan Mueller
    Replies:
    5
    Views:
    549
    Steven Saunderson
    Jul 10, 2006
  3. John Joyce

    gets gets

    John Joyce, Mar 26, 2007, in forum: Ruby
    Replies:
    2
    Views:
    380
    John Joyce
    Mar 26, 2007
  4. John Joyce

    Return of gets gets

    John Joyce, Apr 23, 2007, in forum: Ruby
    Replies:
    0
    Views:
    215
    John Joyce
    Apr 23, 2007
  5. libsfan01
    Replies:
    5
    Views:
    273
    Jeff North
    Dec 20, 2006
Loading...

Share This Page