Form submitted

Discussion in 'ASP .Net' started by Eric Shin, Jan 12, 2004.

  1. Eric Shin

    Eric Shin Guest

    Hi all.

    I'm like really on the beginning stage for ASP.NET
    just got a few questions to ask... Please help me.

    I've created a form page called "join.aspx"
    and it has lots of codes but the important part needed to
    be focused on is the following lines.

    <asp:textbox id="firstname" runat="server" />

    and the form tag says

    <form id="Form1" method="get" runat="server"
    action="result.aspx">

    Also, i have a button component whose code is

    <asp:Button ID="submit" Text="Join" Runat="server"
    OnClick="join">

    where the subroutine, 'join' is

    sub join (s as Object, e as EventArgs)
    Response.redirect("result.aspx") 'link page
    end sub

    The result.aspx has only few lines of codes
    <script runat="server">
    sub Page_Load
    three.text = Request.QueryString("firstname")
    end sub
    </script>
    *** AND ***
    <asp:Label ID ="three" Runat="server" />

    I was just wondering if the id "firstname" is global in
    the same project.
    FOr this code, i don't get anything in result.aspx when i
    actually put some random name in the firstname textbox
    field in join.aspx
    Can you tell me what's wrong???


    Sorry, im mixing up with ASP and ASP.NET here....
    Thanks for bearing me.
     
    Eric Shin, Jan 12, 2004
    #1
    1. Advertising

  2. Eric Shin

    Hermit Dave Guest

    with asp.net 1.0 and 1.1... you are restricted to form posting to itself.

    it if you have a join.aspx... and you have a <form runat="server">
    that will always post it to join.aspx.

    if you want to post it to result.aspx consider using html form tag
    <form name="name" action="wherever you wanna postit" >

    with asp.net 1.2 they have a feature which is called Cross Posting (i know i
    know many people have been screaming bout it... cause cross posting refers
    to posts done on multiple newsgroups ). This cross posting feature would
    allow you a <form runat=server> to post to other aspx page as well.. ie with
    1.2 you will be able to do what you want to do... but not just yet...

    --
    Regards,

    HD

    "Eric Shin" <> wrote in message
    news:049e01c3d941$3d901420$...
    > Hi all.
    >
    > I'm like really on the beginning stage for ASP.NET
    > just got a few questions to ask... Please help me.
    >
    > I've created a form page called "join.aspx"
    > and it has lots of codes but the important part needed to
    > be focused on is the following lines.
    >
    > <asp:textbox id="firstname" runat="server" />
    >
    > and the form tag says
    >
    > <form id="Form1" method="get" runat="server"
    > action="result.aspx">
    >
    > Also, i have a button component whose code is
    >
    > <asp:Button ID="submit" Text="Join" Runat="server"
    > OnClick="join">
    >
    > where the subroutine, 'join' is
    >
    > sub join (s as Object, e as EventArgs)
    > Response.redirect("result.aspx") 'link page
    > end sub
    >
    > The result.aspx has only few lines of codes
    > <script runat="server">
    > sub Page_Load
    > three.text = Request.QueryString("firstname")
    > end sub
    > </script>
    > *** AND ***
    > <asp:Label ID ="three" Runat="server" />
    >
    > I was just wondering if the id "firstname" is global in
    > the same project.
    > FOr this code, i don't get anything in result.aspx when i
    > actually put some random name in the firstname textbox
    > field in join.aspx
    > Can you tell me what's wrong???
    >
    >
    > Sorry, im mixing up with ASP and ASP.NET here....
    > Thanks for bearing me.
    >
     
    Hermit Dave, Jan 12, 2004
    #2
    1. Advertising

  3. Eric Shin

    Guest Guest

    The problem is that you are not posting to result.aspx,
    you're just redirecting.
    No "firstname" is not global to the whole project. The
    value of this field is posted to the server with each
    request. I see that you set action="result.aspx" page, you
    were on right track, but you didn't need to do that.
    Here's one solution:

    Remove action="results.aspx", and add the following code
    to "join" sub

    sub join (s as Object, e as EventArgs)
    Response.redirect("result.aspx?firstname=" &
    Server.URLEncode(firstname.text)) 'link page
    end sub

    >-----Original Message-----
    >Hi all.
    >
    >I'm like really on the beginning stage for ASP.NET
    >just got a few questions to ask... Please help me.
    >
    >I've created a form page called "join.aspx"
    >and it has lots of codes but the important part needed to
    >be focused on is the following lines.
    >
    ><asp:textbox id="firstname" runat="server" />
    >
    >and the form tag says
    >
    ><form id="Form1" method="get" runat="server"
    >action="result.aspx">
    >
    >Also, i have a button component whose code is
    >
    ><asp:Button ID="submit" Text="Join" Runat="server"
    >OnClick="join">
    >
    >where the subroutine, 'join' is
    >
    >sub join (s as Object, e as EventArgs)
    > Response.redirect("result.aspx") 'link page
    >end sub
    >
    >The result.aspx has only few lines of codes
    ><script runat="server">
    > sub Page_Load
    > three.text = Request.QueryString("firstname")
    > end sub
    ></script>
    >*** AND ***
    ><asp:Label ID ="three" Runat="server" />
    >
    >I was just wondering if the id "firstname" is global in
    >the same project.
    >FOr this code, i don't get anything in result.aspx when i
    >actually put some random name in the firstname textbox
    >field in join.aspx
    >Can you tell me what's wrong???
    >
    >
    >Sorry, im mixing up with ASP and ASP.NET here....
    >Thanks for bearing me.
    >
    >.
    >
     
    Guest, Jan 12, 2004
    #3
  4. Eric Shin

    Martha[MSFT] Guest

    If you want to retrieve information that was submitted in the form from your
    new page, you can use standard HTML form tags instead of ASP.NET controls.
    You can't post a form to a different page if you use the server-side version
    of the <form> tag. So use something like:
    <form Method = "Post" Action="results.aspx">
    <input name="firstname">

    And in results.aspx page, you can do:
    three.Text = Request.Params("firstname")


    Hope this helps,
    Martha


    "Eric Shin" <> wrote in message
    news:049e01c3d941$3d901420$...
    > Hi all.
    >
    > I'm like really on the beginning stage for ASP.NET
    > just got a few questions to ask... Please help me.
    >
    > I've created a form page called "join.aspx"
    > and it has lots of codes but the important part needed to
    > be focused on is the following lines.
    >
    > <asp:textbox id="firstname" runat="server" />
    >
    > and the form tag says
    >
    > <form id="Form1" method="get" runat="server"
    > action="result.aspx">
    >
    > Also, i have a button component whose code is
    >
    > <asp:Button ID="submit" Text="Join" Runat="server"
    > OnClick="join">
    >
    > where the subroutine, 'join' is
    >
    > sub join (s as Object, e as EventArgs)
    > Response.redirect("result.aspx") 'link page
    > end sub
    >
    > The result.aspx has only few lines of codes
    > <script runat="server">
    > sub Page_Load
    > three.text = Request.QueryString("firstname")
    > end sub
    > </script>
    > *** AND ***
    > <asp:Label ID ="three" Runat="server" />
    >
    > I was just wondering if the id "firstname" is global in
    > the same project.
    > FOr this code, i don't get anything in result.aspx when i
    > actually put some random name in the firstname textbox
    > field in join.aspx
    > Can you tell me what's wrong???
    >
    >
    > Sorry, im mixing up with ASP and ASP.NET here....
    > Thanks for bearing me.
    >
     
    Martha[MSFT], Jan 12, 2004
    #4
  5. Eric Shin

    Martha[MSFT] Guest

    You have two alternatives to control how a user moves from one page to
    another. If you want to retrieve information that was submitted in the form
    from your new page, you can use standard HTML form tags instead of ASP.NET
    controls. You can't post a form to a different page if you use the
    server-side version of the <form> tag. So use something like:
    <form Method = "Post" Action="results.aspx">
    <input name="firstname">

    And in results.aspx page, you can do:
    three.Text = Request.Params("firstname")


    Hope this helps,
    Martha


    "Eric Shin" <> wrote in message
    news:049e01c3d941$3d901420$...
    > Hi all.
    >
    > I'm like really on the beginning stage for ASP.NET
    > just got a few questions to ask... Please help me.
    >
    > I've created a form page called "join.aspx"
    > and it has lots of codes but the important part needed to
    > be focused on is the following lines.
    >
    > <asp:textbox id="firstname" runat="server" />
    >
    > and the form tag says
    >
    > <form id="Form1" method="get" runat="server"
    > action="result.aspx">
    >
    > Also, i have a button component whose code is
    >
    > <asp:Button ID="submit" Text="Join" Runat="server"
    > OnClick="join">
    >
    > where the subroutine, 'join' is
    >
    > sub join (s as Object, e as EventArgs)
    > Response.redirect("result.aspx") 'link page
    > end sub
    >
    > The result.aspx has only few lines of codes
    > <script runat="server">
    > sub Page_Load
    > three.text = Request.QueryString("firstname")
    > end sub
    > </script>
    > *** AND ***
    > <asp:Label ID ="three" Runat="server" />
    >
    > I was just wondering if the id "firstname" is global in
    > the same project.
    > FOr this code, i don't get anything in result.aspx when i
    > actually put some random name in the firstname textbox
    > field in join.aspx
    > Can you tell me what's wrong???
    >
    >
    > Sorry, im mixing up with ASP and ASP.NET here....
    > Thanks for bearing me.
    >
     
    Martha[MSFT], Jan 12, 2004
    #5
  6. Eric Shin

    Martha[MSFT] Guest

    If you want to retrieve information that was submitted in the form from your
    new page, you can use standard HTML form tags instead of ASP.NET controls.
    You CANNOT post a form to a different page if you use the server-side
    version of the <form> tag. So use something like:
    <form Method = "Post" Action="results.aspx">
    <input name="firstname">

    And in results.aspx page, you can do:
    three.Text = Request.Params("firstname")


    Hope this helps,
    Martha


    "Eric Shin" <> wrote in message
    news:049e01c3d941$3d901420$...
    > Hi all.
    >
    > I'm like really on the beginning stage for ASP.NET
    > just got a few questions to ask... Please help me.
    >
    > I've created a form page called "join.aspx"
    > and it has lots of codes but the important part needed to
    > be focused on is the following lines.
    >
    > <asp:textbox id="firstname" runat="server" />
    >
    > and the form tag says
    >
    > <form id="Form1" method="get" runat="server"
    > action="result.aspx">
    >
    > Also, i have a button component whose code is
    >
    > <asp:Button ID="submit" Text="Join" Runat="server"
    > OnClick="join">
    >
    > where the subroutine, 'join' is
    >
    > sub join (s as Object, e as EventArgs)
    > Response.redirect("result.aspx") 'link page
    > end sub
    >
    > The result.aspx has only few lines of codes
    > <script runat="server">
    > sub Page_Load
    > three.text = Request.QueryString("firstname")
    > end sub
    > </script>
    > *** AND ***
    > <asp:Label ID ="three" Runat="server" />
    >
    > I was just wondering if the id "firstname" is global in
    > the same project.
    > FOr this code, i don't get anything in result.aspx when i
    > actually put some random name in the firstname textbox
    > field in join.aspx
    > Can you tell me what's wrong???
    >
    >
    > Sorry, im mixing up with ASP and ASP.NET here....
    > Thanks for bearing me.
    >
     
    Martha[MSFT], Jan 12, 2004
    #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. SWu
    Replies:
    0
    Views:
    580
  2. ben
    Replies:
    0
    Views:
    1,068
  3. =?Utf-8?B?TWFyayBQYXJ0ZXI=?=

    Form still being submitted despite being invalid

    =?Utf-8?B?TWFyayBQYXJ0ZXI=?=, Jul 25, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    611
  4. Isofarro
    Replies:
    1
    Views:
    367
    William Tasso
    Aug 18, 2003
  5. David Dorward
    Replies:
    0
    Views:
    415
    David Dorward
    Aug 18, 2003
Loading...

Share This Page