Form submitted

  • Thread starter Thread starter Eric Shin
  • Start date Start date
E

Eric Shin

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.
 
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...
 
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
 
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
 
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
 
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
 
Back
Top