Form submitted

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.
 
H

Hermit Dave

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...
 
G

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
 
M

Martha[MSFT]

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
 
M

Martha[MSFT]

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
 
M

Martha[MSFT]

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top