Thank you very much..
Now I think I'm getting better and better on this stuff.
One more question,
I do not want user to go to secondPage.aspx directly.
in order to get into second page, user must go through firstPage.aspx
first (by submitting form)
how do I do that?
Hi Britney,
If you were to use Server.Transfer ("secondPage.aspx", true); in the
first
page then you can access the values of the textboxes in the second
page
using
the forms collections, e.g. Request.Form["txtBox1"] would get you the
value
inside the textbox with the id "txtBox1" that the user entered on the
first
page.
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
:
okay.. .you're absolutely right..
Now... the reason I want to do "action" in the form originally is
because I
want testing2.aspx receive values of two textboxes from default.aspx
page.
if I do server.redirect, then how can testing2.aspx remember those
values I
entered from prevous page?
Hi Britney,
Notice that server.transfer does not cause the browser Address line
to
change to indicate the new URL (this is probably why you thought it
did
not
work), but if you put any action in the Page_Load of the new page
you
will
realize that the second page is running.
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
:
I tried the following in my code-behind cs file, but it doesn't
work.
I don't see it redirect to testing2.aspx..
So this is strange, any idea?
private void Button1_Click(object sender, System.EventArgs e)
{
Server.Transfer("testing2.aspx", true);
}
message
Hi Britney,
"Cross page postback" is not a feature of ASP.NET 1.x, as you
just
discovered. It is however a feature in ASP.NET 2.0 (currently
in
beta
release) where a button can have a value for a PostBackUrl
property.
You
can
read about this feature on the ASP.NET 2.0 Quickstart tutorials
http://beta.asp.net/QUICKSTART/aspnet/doc/tipstricks/default.aspx
Currently, you would have to use Server.Transfer(URL, bool) in
response
for
a ButtonClick event to transfer your form to another page; the
bool
parameter
would determine if want to keep (true) or clear (false) the Form
and
QueryString collections. This link has the full syntax of the
transfer
method:
http://msdn.microsoft.com/library/d...temwebhttpserverutilityclasstransfertopic.asp
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
:
Hi guys,
in my default.aspx file, I have following code.
when I go to browser, I enter values in both textboxs, then I
hit
submit
Button,
however, it didn't go to page2.aspx. instead, it was still in
default
page.
I thought Action will direct page to page2.aspx, no???
<form id="Form1" method="post" runat="server"
action="page2.aspx">
<asp:TextBox id="TextBox1" runat="server"></asp:TextBox>
<asp:TextBox id="TextBox2" runat="server"></asp:TextBox>
<asp:Button id="Button1" runat="server"
Text="Button"></asp:Button>
</form>