aspx_professional thread: =?gb2312?Q?=B4=F0=B8=B4:=5Baspx=5Fprofessional=5D_Need_help:_problem_with_c?
=?gb2312?Q?hapter_3_beginning_asp.net_using?=
------=_NextPart_001_0001_01C1E4C4.25590B00
Content-Type: text/plain; charset="gb2312"
Content-Transfer-Encoding: quoted-printable
Yes,it is normal.A runat=3Dserver form can only submit to the same page t
hat include the form.It just like the winform.Or How can the server hold
the state of server control?
If you need transfer the value to next page ,you can use Session and Resp
onse.redirect.
----- =D4=AD=CA=BC=D3=CA=BC=FE -----
=B7=A2=BC=FE=C8=CB: mathew2002it@y...
=B7=A2=CB=CD=CA=B1=BC=E4: 2002=C4=EA4=D4=C215=C8=D5 11:13
=CA=D5=BC=FE=C8=CB: ASPX_Professional
=D6=F7=CC=E2: [aspx_professional] Need help: problem with chapter 3 begin
ning asp.net using c# ( passing variable to another aspx page)
Hi,
I have some problems with the example given in chapter 3 Beginning ASP.ne
t
using C#. When i run the holidaypage.aspx, error occured as written in th
e
browser as follow:
Exception Details: System.Web.HttpException: Control 'FullName' of
type 'TextBox' must be placed inside a form tag with runat=3Dserver.
After i put the runat=3D"server" inside the form tag, there was no error
but
when the submit button was pressed, the value from the form seem like not
passing to the second aspx page (holidayresponse.aspx). It just stay on
the same page. When i view the source in the browser, i found out that th
e
form tag generated as below
<form name=3D"_ctl0" method=3D"post" action=3D"holidaypage.aspx" id=3D"_c
tl0">
has the action attribute that link to the same holidaypage.aspx and not
holidayresponse.aspx. I think that's why all the value from the form is
not passing to holidayresponse.aspx. Does anyone has any idea to overcome
this problem of passing value to another aspx page. Thank you.
Mathew
These are the original source codes downloaded from wrox
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
holidaypage.aspx
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
<html>
<head>
<title>Holiday page</title>
</head>
<body>
<form action=3D"holidayresponse.aspx" method=3D"post">
<h1>Feiertag Holidays</h1>
Please enter your details here.
<br /><br />
Name:<asp:textbox id=3D"FullName" runat=3D"server" />
<br /><br />
Address:<asp:textbox id=3D"Address" rows=3D"5" textmode=3D"multiline"
runat=3D"server" />
<br /><br />
Sex -
<asp:radiobuttonlist id=3D"sex" runat=3D"server">
<asp:listitem value=3D"Male" />
<asp:listitem value=3D"Female" />
</asp:radiobuttonlist>
Please select the destination you would like details on:
<asp:dropdownlist id=3D"Destination" runat=3D"server">
<asp:listitem value=3D"Madrid" />
<asp:listitem value=3D"Barcelona"/>
<asp:listitem value=3D"Lisbon"/>
<asp:listitem value=3D"Oslo"/>
<asp:listitem value=3D"Prague"/>
</asp:dropdownlist>
<br /><br />
<input type=3D"Submit">
<input type=3D"Reset">
</form>
</body>
</html>
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
holidayresponse.aspx
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
<script runat=3D"server" language=3D"c#">
void Page_Load()
{
Response.Write("<b>Name:</b> " + Request.Form["FullName"] + "<br />")
;
Response.Write("<b>Address:</b> " + Request.Form["Address"]
+ "<br />");
Response.Write("<b>Sex:</b> " + Request.Form["Sex"] + "<br />");
Response.Write("<b>Destination:</b> " + Request.Form["Destination"]
+ "<br />");
}
</script>
<html>
<head>
<title>Holiday page</title>
</head>
<body>
<br /><br />
These details have been entered into our database, you should receive a
confirmation email from us shortly.
<br /><br />
</body>
</html>
to unsubscribe send a blank email to leave-aspx_professional-1080667J@p...
.wrox.com.=B4=D3=CD=F8=D5=BE=B5=C3=B5=BD=B8=FC=B6=E0=D0=C5=CF=A2=A1=A3MSN
Explorer =C3=E2=B7=D1=CF=C2=D4=D8:http://explorer.msn.com/lccn