Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Email From Forms with asp:panel.(s) Only one panel works?

Reply
Thread Tools

Email From Forms with asp:panel.(s) Only one panel works?

 
 
Harry
Guest
Posts: n/a
 
      11-07-2003
Hi,

Can anyone help.

I have a asp.net page (c#), with two panels, both of which have
asp:textboxes on.
When I press the first button, the second panel shows fine.
When I press the button in the second panel, it triggers the script to
send the form details by email.

Problem is, the fields from the first panel do not get sent, only the
fields from the second panel.
(Weird thing is the line breaks <br> do get sent!)

At a guess, do I need to add something to the page_load fuction to
help remember or am i totally the wrong track!

Below is sample script if anyone can help me out!

Thanks
H

<%@ Page language="C#" %>
<%@ Import NameSpace="System.Web" %>
<%@ Import NameSpace="System.Web.Mail" %>
<script runat="server" language="C#">

protected void Send_Email(Object Sender, EventArgs e) {
MailMessage MyMail = new MailMessage();
MyMail.To = "(E-Mail Removed)";
MyMail.From = "(E-Mail Removed)";
MyMail.BodyFormat = MailFormat.Html;
MyMail.Subject = "OPTION1 - User Registrations";
MyMail.Body = Request.Form["bt_tel"] + "<br>" +
Request.Form["LastName"] + "<br>" +
Request.Form["LastName"] + "<br>" +
Request.Form["Address1"] + "<br>" +
Request.Form["Address2"] + "<br>" +
Request.Form["Address3"] + "<br>" +
Request.Form["postcode"] + "<br>" +
Request.Form["username"] + "<br>" +
Request.Form["Password"] + "<br>" +
Request.Form["contact_num"] + "<br>" +
Request.Form["EmailAddress"];
//SmtpMail.SmtpServer = "localhost";
//Response.Flush();
try{
SmtpMail.Send(MyMail);
//Response.Write("Your Email has been sent sucessfully Thank
You"); //Line removed as don't page will redirect instead. Put line
back when debugging.
Response.Redirect("confirm.aspx");
}
catch (Exception exc){
//Response.Redirect("ordererror.aspx");
Response.Write("Send failure: " + exc.ToString()); // Line
Removed. Put back when debugging, to have error messgaes displayed.
Don;t forget to blank out the response redirect command!
}
}

void Page_Load(Object Sender, EventArgs e) {
panel1.Visible = true;
panel2.Visible = false;
}

void Page2_Visible(Object Sender, EventArgs e) {
panel1.Visible = false;
panel2.Visible = true;
}



</script>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
</head>
<body>
<form id="form1" runat="server">
<aspanel runat="server" ID="panel1">
<table width="736" border="0" cellspacing="0" cellpadding="0"
height="321">
<tr>
<td width="736" height="321" valign="top" bgcolor="#FFFFFF"
class="bodytxt"><span class="Faqmaintext"><strong><br>
Personal
Details:<br>
</strong></span><span class="ORDsmallprint">Items marked with *
are compulsary.</span> <br>

<table width="100%" border="0" align="center">
<tr>
<td align="right" nowrap class="Faqmaintext">BT Telephone
Number:</td>
<td><asp:textbox CssClass="FRMfield" ID="bt_tel"
runat="server" Width="200" />
*</td>
<td><asp:requiredfieldvalidator ControlToValidate="bt_tel"
Display="Dynamic" EnableClientScript="true" ErrorMessage="Required"
Font-Name="Arial" Font-Size="x-small" ID="RequiredFieldValidator1"
runat="server"></asp:requiredfieldvalidator></td>
</tr>
<tr>
<td colspan="3" align="right" nowrap
class="Faqmaintext">&nbsp;</td>
</tr>
<tr>
<td width="35%" align="right" nowrap
class="Faqmaintext"><b>First Name:</b></td>
<td width="30%"><asp:textbox CssClass="FRMfield"
ID="FirstName" runat="server" Width="200" />
* </td>
<td width="35%"><asp:requiredfieldvalidator
ControlToValidate="FirstName" Display="Dynamic"
EnableClientScript="true" ErrorMessage="Required" Font-Name="Arial"
Font-Size="x-small" ID="RequiredFieldValidator2"
runat="server"></asp:requiredfieldvalidator>
</td>
</tr>
<tr>
<td align="right" nowrap
class="Faqmaintext"><b>Surname:</b></td>
<td><asp:textbox CssClass="FRMfield" ID="LastName"
runat="server" Width="200" />
* </td>
<td><asp:requiredfieldvalidator ID="RequiredFieldValidator3"
Font-Size="x-small" Font-Name="Arial" EnableClientScript="true"
Display="Dynamic" ErrorMessage="Required" ControlToValidate="LastName"
runat="server" ></asp:requiredfieldvalidator></td>
</tr>
<tr>
<td align="right" nowrap class="Faqmaintext">&nbsp;</td>
<td>&nbsp; </td>
<td>&nbsp;</td>
</tr>
<tr>
<td align="right" valign="top" nowrap
class="Faqmaintext"><b>Address:</b></td>
<td>
<asp:textbox CssClass="FRMfield" ID="Address1" Rows="6" runat="server"
TextMode="SingleLine" Width="200" />
*</td>
<td valign="top"><asp:requiredfieldvalidator
ID="RequiredFieldValidator4" Font-Size="x-small" Font-Name="Arial"
EnableClientScript="true" Display="Dynamic" ErrorMessage="Required"
ControlToValidate="Address1"
runat="server"></asp:requiredfieldvalidator></td>
</tr>
<tr>
<td align="right" nowrap class="Faqmaintext">&nbsp;</td>
<td><asp:textbox CssClass="FRMfield" ID="Address2" Rows="6"
runat="server" TextMode="SingleLine" Width="200" /></td>
<td>&nbsp;</td>
</tr>
<tr>
<td align="right" nowrap class="Faqmaintext">Town:</td>
<td><asp:textbox CssClass="FRMfield" ID="Address3" Rows="6"
runat="server" TextMode="SingleLine" Width="200" /></td>
<td>&nbsp;</td>
</tr>
<tr>
<td align="right" nowrap class="Faqmaintext">Postcode:</td>
<td><asp:textbox CssClass="FRMfield" ID="postcode"
runat="server" TextMode="SingleLine" Width="200" />
*</td>
<td><asp:requiredfieldvalidator ControlToValidate="postcode"
Display="Dynamic" ErrorMessage="Required" Font-Name="Arial"
Font-Size="x-small" ID="rfvpostcode" runat="server" />&nbsp;</td>
</tr>
<tr>
<td align="right" nowrap class="Faqmaintext">&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td height="30"><div align="left">
<div align="center"><asp:button ID="btn1" Text="Next
Step" runat="server" CssClass="FRMfield" OnClick="Page2_Visible"
></asp:button></div>

</td>
<td></td>
</tr>
</table>
</td>
</tr>
</table>
</aspanel>
<aspanel runat="server" ID="panel2">
<span class="Faqmaintext"><strong><br>
User Details:<br>
</strong></span><span class="ORDsmallprint">Items
marked with * are compulsary.</span><br>
<table width="100%" border="0" align="center">
<tr>
<td align="right" nowrap class="Faqmaintext">Select
Username:</td>
<td><asp:textbox CssClass="FRMfield" ID="username"
runat="server" TextMode="SingleLine" Width="200" />
*</td>
<td><asp:requiredfieldvalidator ID="RequiredFieldValidator5"
Font-Size="x-small" Font-Name="Arial" EnableClientScript="true"
Display="Dynamic" ErrorMessage="Required" ControlToValidate="username"
runat="server" ></asp:requiredfieldvalidator></td>
</tr>
<tr>
<td colspan="3" align="right" nowrap
class="Faqmaintext">&nbsp;</td>
</tr>
<tr>
<td width="34%" align="right" nowrap
class="Faqmaintext"><b>Password:</b></td>
<td width="29%"><asp:textbox CssClass="FRMfield"
TextMode="Password" ID="Password" runat="server" Width="200"/>
*</td>
<td width="37%"><asp:requiredfieldvalidator
ID="RequiredFieldValidator6" Font-Size="x-small" Font-Name="Arial"
EnableClientScript="true" Display="Dynamic" ErrorMessage="Required"
ControlToValidate="Password"
runat="server"></asp:requiredfieldvalidator></td>
</tr>
<tr>
<td align="right" nowrap class="Faqmaintext"><b>Confirm
Password: </b></td>
<td><asp:textbox CssClass="FRMfield" TextMode="Password"
ID="PasswordConfirm" runat="server" Width="200" />
*</td>
<td><asp:requiredfieldvalidator ID="RequiredFieldValidator7"
Font-Size="x-small" Font-Name="Arial" EnableClientScript="true"
Display="Dynamic" ErrorMessage="Required"
ControlToValidate="PasswordConfirm"
runat="server"></asp:requiredfieldvalidator>
<asp:comparevalidator ControlToCompare="Password"
ID="CompareValidator1" Font-Size="x-small" Font-Name="Arial"
EnableClientScript="true" Display="Dynamic" ErrorMessage="Your
passwords do not match" ControlToValidate="PasswordConfirm"
runat="server"></asp:comparevalidator>
</td>
</tr>
<tr>
<td align="right" nowrap class="Faqmaintext">&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td align="right" valign="top" nowrap
class="Faqmaintext">Contact Telephone
Number:</td>
<td><asp:textbox CssClass="FRMfield" TextMode="SingleLine"
ID="contact_num" runat="server" Width="200" />
*</td>
<td valign="top">&nbsp;</td>
</tr>
<tr>
<td align="right" nowrap class="Faqmaintext"><b>
E-mail:</b></td>
<td><asp:textbox CssClass="FRMfield" ID="EmailAddress"
runat="server" Width="200"/></td>
<td><asp:regularexpressionvalidator
ID="RegularExpressionValidator1" EnableClientScript="true"
Display="Dynamic" ErrorMessage="Please enter a valid email address"
ControlToValidate="EmailAddress"
ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
runat="server" Font-Size="x-small"
Font-Name="Arial"></asp:regularexpressionvalidator></td>
</tr>
<tr>
<td align="right" nowrap class="Faqmaintext">&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td align="right" nowrap class="Faqmaintext">&nbsp;</td>
<td class="Faqmaintext"><div align="center"></div></td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="80" colspan="3"><div align="center"
class="ORDsummary">
<p>Package Summary</p>
<p>You have selected
<font color="#FF0000">OPTION 1 (256k)</font> which wil
be charged at <font color="#FF0000">&pound;22</font> per month. <br>
Your Credit/Debit
card will be charged on the 15th of every month, one
month in
advance.<br>
Press the continue button to proceed to the payment
pages.</p>
</div></td>
</tr>
<tr>
<td align="right" nowrap class="Faqmaintext">&nbsp;</td>
<td>&nbsp; </td>
<td>&nbsp; </td>
</tr>
<tr>
<td height="19" colspan="3" class="ORDsmallprint"><div
align="center">By
pressing 'Continue', you agree to abide by the OPTIMUMi <a
href="#">Terms
and Conditions</a> of the Broadband service.</div>
</td>
</tr>
<tr>
<td class="Faqmaintext">&nbsp;</td>
<td height="30" align="right"><div align="center">
<asp:button runat="server" OnClick="Send_Email"
Text="Continue" CssClass="FRMfield"></asp:Button>
</div>
</td>
<td>&nbsp;</td>
</tr>
</table>
</aspanel>
</form>
</body>
</html>
 
Reply With Quote
 
 
 
 
Harry
Guest
Posts: n/a
 
      11-09-2003
Hi,

After reading up on a few things (asp.net beginners manuals!) I had a
thought about using session variables and such, but then I thought
isn't aspanel supposed to negate the need for that?

Can anyone help me explain the exact workings of ASPanel along with
my original question.
(I did read up on msdn, but that kinda started going over my head!)

Cheers
H




http://www.velocityreviews.com/forums/(E-Mail Removed) (Harry) wrote in message news:<(E-Mail Removed). com>...
> Hi,
>
> Can anyone help.
>
> I have a asp.net page (c#), with two panels, both of which have
> asp:textboxes on.
> When I press the first button, the second panel shows fine.
> When I press the button in the second panel, it triggers the script to
> send the form details by email.
>
> Problem is, the fields from the first panel do not get sent, only the
> fields from the second panel.
> (Weird thing is the line breaks <br> do get sent!)
>
> At a guess, do I need to add something to the page_load fuction to
> help remember or am i totally the wrong track!
>
> Below is sample script if anyone can help me out!
>
> Thanks
> H
>
> <%@ Page language="C#" %>
> <%@ Import NameSpace="System.Web" %>
> <%@ Import NameSpace="System.Web.Mail" %>
> <script runat="server" language="C#">
>
> protected void Send_Email(Object Sender, EventArgs e) {
> MailMessage MyMail = new MailMessage();
> MyMail.To = "(E-Mail Removed)";
> MyMail.From = "(E-Mail Removed)";
> MyMail.BodyFormat = MailFormat.Html;
> MyMail.Subject = "OPTION1 - User Registrations";
> MyMail.Body = Request.Form["bt_tel"] + "<br>" +
> Request.Form["LastName"] + "<br>" +
> Request.Form["LastName"] + "<br>" +
> Request.Form["Address1"] + "<br>" +
> Request.Form["Address2"] + "<br>" +
> Request.Form["Address3"] + "<br>" +
> Request.Form["postcode"] + "<br>" +
> Request.Form["username"] + "<br>" +
> Request.Form["Password"] + "<br>" +
> Request.Form["contact_num"] + "<br>" +
> Request.Form["EmailAddress"];
> //SmtpMail.SmtpServer = "localhost";
> //Response.Flush();
> try{
> SmtpMail.Send(MyMail);
> //Response.Write("Your Email has been sent sucessfully Thank
> You"); //Line removed as don't page will redirect instead. Put line
> back when debugging.
> Response.Redirect("confirm.aspx");
> }
> catch (Exception exc){
> //Response.Redirect("ordererror.aspx");
> Response.Write("Send failure: " + exc.ToString()); // Line
> Removed. Put back when debugging, to have error messgaes displayed.
> Don;t forget to blank out the response redirect command!
> }
> }
>
> void Page_Load(Object Sender, EventArgs e) {
> panel1.Visible = true;
> panel2.Visible = false;
> }
>
> void Page2_Visible(Object Sender, EventArgs e) {
> panel1.Visible = false;
> panel2.Visible = true;
> }
>
>
>
> </script>
> <html>
> <head>
> <title>Untitled Document</title>
> <meta http-equiv="Content-Type" content="text/html;
> charset=iso-8859-1">
> </head>
> <body>
> <form id="form1" runat="server">
> <aspanel runat="server" ID="panel1">
> <table width="736" border="0" cellspacing="0" cellpadding="0"
> height="321">
> <tr>
> <td width="736" height="321" valign="top" bgcolor="#FFFFFF"
> class="bodytxt"><span class="Faqmaintext"><strong><br>
> Personal
> Details:<br>
> </strong></span><span class="ORDsmallprint">Items marked with *
> are compulsary.</span> <br>
>
> <table width="100%" border="0" align="center">
> <tr>
> <td align="right" nowrap class="Faqmaintext">BT Telephone
> Number:</td>
> <td><asp:textbox CssClass="FRMfield" ID="bt_tel"
> runat="server" Width="200" />
> *</td>
> <td><asp:requiredfieldvalidator ControlToValidate="bt_tel"
> Display="Dynamic" EnableClientScript="true" ErrorMessage="Required"
> Font-Name="Arial" Font-Size="x-small" ID="RequiredFieldValidator1"
> runat="server"></asp:requiredfieldvalidator></td>
> </tr>
> <tr>
> <td colspan="3" align="right" nowrap
> class="Faqmaintext">&nbsp;</td>
> </tr>
> <tr>
> <td width="35%" align="right" nowrap
> class="Faqmaintext"><b>First Name:</b></td>
> <td width="30%"><asp:textbox CssClass="FRMfield"
> ID="FirstName" runat="server" Width="200" />
> * </td>
> <td width="35%"><asp:requiredfieldvalidator
> ControlToValidate="FirstName" Display="Dynamic"
> EnableClientScript="true" ErrorMessage="Required" Font-Name="Arial"
> Font-Size="x-small" ID="RequiredFieldValidator2"
> runat="server"></asp:requiredfieldvalidator>
> </td>
> </tr>
> <tr>
> <td align="right" nowrap
> class="Faqmaintext"><b>Surname:</b></td>
> <td><asp:textbox CssClass="FRMfield" ID="LastName"
> runat="server" Width="200" />
> * </td>
> <td><asp:requiredfieldvalidator ID="RequiredFieldValidator3"
> Font-Size="x-small" Font-Name="Arial" EnableClientScript="true"
> Display="Dynamic" ErrorMessage="Required" ControlToValidate="LastName"
> runat="server" ></asp:requiredfieldvalidator></td>
> </tr>
> <tr>
> <td align="right" nowrap class="Faqmaintext">&nbsp;</td>
> <td>&nbsp; </td>
> <td>&nbsp;</td>
> </tr>
> <tr>
> <td align="right" valign="top" nowrap
> class="Faqmaintext"><b>Address:</b></td>
> <td>
> <asp:textbox CssClass="FRMfield" ID="Address1" Rows="6" runat="server"
> TextMode="SingleLine" Width="200" />
> *</td>
> <td valign="top"><asp:requiredfieldvalidator
> ID="RequiredFieldValidator4" Font-Size="x-small" Font-Name="Arial"
> EnableClientScript="true" Display="Dynamic" ErrorMessage="Required"
> ControlToValidate="Address1"
> runat="server"></asp:requiredfieldvalidator></td>
> </tr>
> <tr>
> <td align="right" nowrap class="Faqmaintext">&nbsp;</td>
> <td><asp:textbox CssClass="FRMfield" ID="Address2" Rows="6"
> runat="server" TextMode="SingleLine" Width="200" /></td>
> <td>&nbsp;</td>
> </tr>
> <tr>
> <td align="right" nowrap class="Faqmaintext">Town:</td>
> <td><asp:textbox CssClass="FRMfield" ID="Address3" Rows="6"
> runat="server" TextMode="SingleLine" Width="200" /></td>
> <td>&nbsp;</td>
> </tr>
> <tr>
> <td align="right" nowrap class="Faqmaintext">Postcode:</td>
> <td><asp:textbox CssClass="FRMfield" ID="postcode"
> runat="server" TextMode="SingleLine" Width="200" />
> *</td>
> <td><asp:requiredfieldvalidator ControlToValidate="postcode"
> Display="Dynamic" ErrorMessage="Required" Font-Name="Arial"
> Font-Size="x-small" ID="rfvpostcode" runat="server" />&nbsp;</td>
> </tr>
> <tr>
> <td align="right" nowrap class="Faqmaintext">&nbsp;</td>
> <td>&nbsp;</td>
> <td>&nbsp;</td>
> </tr>
> <tr>
> <td></td>
> <td height="30"><div align="left">
> <div align="center"><asp:button ID="btn1" Text="Next
> Step" runat="server" CssClass="FRMfield" OnClick="Page2_Visible"
> ></asp:button></div>

> </td>
> <td></td>
> </tr>
> </table>
> </td>
> </tr>
> </table>
> </aspanel>
> <aspanel runat="server" ID="panel2">
> <span class="Faqmaintext"><strong><br>
> User Details:<br>
> </strong></span><span class="ORDsmallprint">Items
> marked with * are compulsary.</span><br>
> <table width="100%" border="0" align="center">
> <tr>
> <td align="right" nowrap class="Faqmaintext">Select
> Username:</td>
> <td><asp:textbox CssClass="FRMfield" ID="username"
> runat="server" TextMode="SingleLine" Width="200" />
> *</td>
> <td><asp:requiredfieldvalidator ID="RequiredFieldValidator5"
> Font-Size="x-small" Font-Name="Arial" EnableClientScript="true"
> Display="Dynamic" ErrorMessage="Required" ControlToValidate="username"
> runat="server" ></asp:requiredfieldvalidator></td>
> </tr>
> <tr>
> <td colspan="3" align="right" nowrap
> class="Faqmaintext">&nbsp;</td>
> </tr>
> <tr>
> <td width="34%" align="right" nowrap
> class="Faqmaintext"><b>Password:</b></td>
> <td width="29%"><asp:textbox CssClass="FRMfield"
> TextMode="Password" ID="Password" runat="server" Width="200"/>
> *</td>
> <td width="37%"><asp:requiredfieldvalidator
> ID="RequiredFieldValidator6" Font-Size="x-small" Font-Name="Arial"
> EnableClientScript="true" Display="Dynamic" ErrorMessage="Required"
> ControlToValidate="Password"
> runat="server"></asp:requiredfieldvalidator></td>
> </tr>
> <tr>
> <td align="right" nowrap class="Faqmaintext"><b>Confirm
> Password: </b></td>
> <td><asp:textbox CssClass="FRMfield" TextMode="Password"
> ID="PasswordConfirm" runat="server" Width="200" />
> *</td>
> <td><asp:requiredfieldvalidator ID="RequiredFieldValidator7"
> Font-Size="x-small" Font-Name="Arial" EnableClientScript="true"
> Display="Dynamic" ErrorMessage="Required"
> ControlToValidate="PasswordConfirm"
> runat="server"></asp:requiredfieldvalidator>
> <asp:comparevalidator ControlToCompare="Password"
> ID="CompareValidator1" Font-Size="x-small" Font-Name="Arial"
> EnableClientScript="true" Display="Dynamic" ErrorMessage="Your
> passwords do not match" ControlToValidate="PasswordConfirm"
> runat="server"></asp:comparevalidator>
> </td>
> </tr>
> <tr>
> <td align="right" nowrap class="Faqmaintext">&nbsp;</td>
> <td>&nbsp;</td>
> <td>&nbsp;</td>
> </tr>
> <tr>
> <td align="right" valign="top" nowrap
> class="Faqmaintext">Contact Telephone
> Number:</td>
> <td><asp:textbox CssClass="FRMfield" TextMode="SingleLine"
> ID="contact_num" runat="server" Width="200" />
> *</td>
> <td valign="top">&nbsp;</td>
> </tr>
> <tr>
> <td align="right" nowrap class="Faqmaintext"><b>
> E-mail:</b></td>
> <td><asp:textbox CssClass="FRMfield" ID="EmailAddress"
> runat="server" Width="200"/></td>
> <td><asp:regularexpressionvalidator
> ID="RegularExpressionValidator1" EnableClientScript="true"
> Display="Dynamic" ErrorMessage="Please enter a valid email address"
> ControlToValidate="EmailAddress"
> ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
> runat="server" Font-Size="x-small"
> Font-Name="Arial"></asp:regularexpressionvalidator></td>
> </tr>
> <tr>
> <td align="right" nowrap class="Faqmaintext">&nbsp;</td>
> <td>&nbsp;</td>
> <td>&nbsp;</td>
> </tr>
> <tr>
> <td align="right" nowrap class="Faqmaintext">&nbsp;</td>
> <td class="Faqmaintext"><div align="center"></div></td>
> <td>&nbsp;</td>
> </tr>
> <tr>
> <td height="80" colspan="3"><div align="center"
> class="ORDsummary">
> <p>Package Summary</p>
> <p>You have selected
> <font color="#FF0000">OPTION 1 (256k)</font> which wil
> be charged at <font color="#FF0000">&pound;22</font> per month. <br>
> Your Credit/Debit
> card will be charged on the 15th of every month, one
> month in
> advance.<br>
> Press the continue button to proceed to the payment
> pages.</p>
> </div></td>
> </tr>
> <tr>
> <td align="right" nowrap class="Faqmaintext">&nbsp;</td>
> <td>&nbsp; </td>
> <td>&nbsp; </td>
> </tr>
> <tr>
> <td height="19" colspan="3" class="ORDsmallprint"><div
> align="center">By
> pressing 'Continue', you agree to abide by the OPTIMUMi <a
> href="#">Terms
> and Conditions</a> of the Broadband service.</div>
> </td>
> </tr>
> <tr>
> <td class="Faqmaintext">&nbsp;</td>
> <td height="30" align="right"><div align="center">
> <asp:button runat="server" OnClick="Send_Email"
> Text="Continue" CssClass="FRMfield"></asp:Button>
> </div>
> </td>
> <td>&nbsp;</td>
> </tr>
> </table>
> </aspanel>
> </form>
> </body>
> </html>

 
Reply With Quote
 
 
 
 
Alvin Bruney
Guest
Posts: n/a
 
      11-10-2003
There's nothing special about the asp panel. It has its own quirks but it is
still regulated by the stateless web environment. You will need viewstate
attribute on if you want the panel to remember it's state. I don't really
understand why you need session variables unless you have view state turned
off and you want to store data to persist against the post backs.
Did I miss what you were asking?

--


-----------
Got TidBits?
Get it here: www.networkip.net/tidbits
"Harry" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> Hi,
>
> After reading up on a few things (asp.net beginners manuals!) I had a
> thought about using session variables and such, but then I thought
> isn't aspanel supposed to negate the need for that?
>
> Can anyone help me explain the exact workings of ASPanel along with
> my original question.
> (I did read up on msdn, but that kinda started going over my head!)
>
> Cheers
> H
>
>
>
>
> (E-Mail Removed) (Harry) wrote in message

news:<(E-Mail Removed). com>...
> > Hi,
> >
> > Can anyone help.
> >
> > I have a asp.net page (c#), with two panels, both of which have
> > asp:textboxes on.
> > When I press the first button, the second panel shows fine.
> > When I press the button in the second panel, it triggers the script to
> > send the form details by email.
> >
> > Problem is, the fields from the first panel do not get sent, only the
> > fields from the second panel.
> > (Weird thing is the line breaks <br> do get sent!)
> >
> > At a guess, do I need to add something to the page_load fuction to
> > help remember or am i totally the wrong track!
> >
> > Below is sample script if anyone can help me out!
> >
> > Thanks
> > H
> >
> > <%@ Page language="C#" %>
> > <%@ Import NameSpace="System.Web" %>
> > <%@ Import NameSpace="System.Web.Mail" %>
> > <script runat="server" language="C#">
> >
> > protected void Send_Email(Object Sender, EventArgs e) {
> > MailMessage MyMail = new MailMessage();
> > MyMail.To = "(E-Mail Removed)";
> > MyMail.From = "(E-Mail Removed)";
> > MyMail.BodyFormat = MailFormat.Html;
> > MyMail.Subject = "OPTION1 - User Registrations";
> > MyMail.Body = Request.Form["bt_tel"] + "<br>" +
> > Request.Form["LastName"] + "<br>" +
> > Request.Form["LastName"] + "<br>" +
> > Request.Form["Address1"] + "<br>" +
> > Request.Form["Address2"] + "<br>" +
> > Request.Form["Address3"] + "<br>" +
> > Request.Form["postcode"] + "<br>" +
> > Request.Form["username"] + "<br>" +
> > Request.Form["Password"] + "<br>" +
> > Request.Form["contact_num"] + "<br>" +
> > Request.Form["EmailAddress"];
> > //SmtpMail.SmtpServer = "localhost";
> > //Response.Flush();
> > try{
> > SmtpMail.Send(MyMail);
> > //Response.Write("Your Email has been sent sucessfully Thank
> > You"); //Line removed as don't page will redirect instead. Put line
> > back when debugging.
> > Response.Redirect("confirm.aspx");
> > }
> > catch (Exception exc){
> > //Response.Redirect("ordererror.aspx");
> > Response.Write("Send failure: " + exc.ToString()); // Line
> > Removed. Put back when debugging, to have error messgaes displayed.
> > Don;t forget to blank out the response redirect command!
> > }
> > }
> >
> > void Page_Load(Object Sender, EventArgs e) {
> > panel1.Visible = true;
> > panel2.Visible = false;
> > }
> >
> > void Page2_Visible(Object Sender, EventArgs e) {
> > panel1.Visible = false;
> > panel2.Visible = true;
> > }
> >
> >
> >
> > </script>
> > <html>
> > <head>
> > <title>Untitled Document</title>
> > <meta http-equiv="Content-Type" content="text/html;
> > charset=iso-8859-1">
> > </head>
> > <body>
> > <form id="form1" runat="server">
> > <aspanel runat="server" ID="panel1">
> > <table width="736" border="0" cellspacing="0" cellpadding="0"
> > height="321">
> > <tr>
> > <td width="736" height="321" valign="top" bgcolor="#FFFFFF"
> > class="bodytxt"><span class="Faqmaintext"><strong><br>
> > Personal
> > Details:<br>
> > </strong></span><span class="ORDsmallprint">Items marked with *
> > are compulsary.</span> <br>
> >
> > <table width="100%" border="0" align="center">
> > <tr>
> > <td align="right" nowrap class="Faqmaintext">BT Telephone
> > Number:</td>
> > <td><asp:textbox CssClass="FRMfield" ID="bt_tel"
> > runat="server" Width="200" />
> > *</td>
> > <td><asp:requiredfieldvalidator ControlToValidate="bt_tel"
> > Display="Dynamic" EnableClientScript="true" ErrorMessage="Required"
> > Font-Name="Arial" Font-Size="x-small" ID="RequiredFieldValidator1"
> > runat="server"></asp:requiredfieldvalidator></td>
> > </tr>
> > <tr>
> > <td colspan="3" align="right" nowrap
> > class="Faqmaintext">&nbsp;</td>
> > </tr>
> > <tr>
> > <td width="35%" align="right" nowrap
> > class="Faqmaintext"><b>First Name:</b></td>
> > <td width="30%"><asp:textbox CssClass="FRMfield"
> > ID="FirstName" runat="server" Width="200" />
> > * </td>
> > <td width="35%"><asp:requiredfieldvalidator
> > ControlToValidate="FirstName" Display="Dynamic"
> > EnableClientScript="true" ErrorMessage="Required" Font-Name="Arial"
> > Font-Size="x-small" ID="RequiredFieldValidator2"
> > runat="server"></asp:requiredfieldvalidator>
> > </td>
> > </tr>
> > <tr>
> > <td align="right" nowrap
> > class="Faqmaintext"><b>Surname:</b></td>
> > <td><asp:textbox CssClass="FRMfield" ID="LastName"
> > runat="server" Width="200" />
> > * </td>
> > <td><asp:requiredfieldvalidator ID="RequiredFieldValidator3"
> > Font-Size="x-small" Font-Name="Arial" EnableClientScript="true"
> > Display="Dynamic" ErrorMessage="Required" ControlToValidate="LastName"
> > runat="server" ></asp:requiredfieldvalidator></td>
> > </tr>
> > <tr>
> > <td align="right" nowrap class="Faqmaintext">&nbsp;</td>
> > <td>&nbsp; </td>
> > <td>&nbsp;</td>
> > </tr>
> > <tr>
> > <td align="right" valign="top" nowrap
> > class="Faqmaintext"><b>Address:</b></td>
> > <td>
> > <asp:textbox CssClass="FRMfield" ID="Address1" Rows="6" runat="server"
> > TextMode="SingleLine" Width="200" />
> > *</td>
> > <td valign="top"><asp:requiredfieldvalidator
> > ID="RequiredFieldValidator4" Font-Size="x-small" Font-Name="Arial"
> > EnableClientScript="true" Display="Dynamic" ErrorMessage="Required"
> > ControlToValidate="Address1"
> > runat="server"></asp:requiredfieldvalidator></td>
> > </tr>
> > <tr>
> > <td align="right" nowrap class="Faqmaintext">&nbsp;</td>
> > <td><asp:textbox CssClass="FRMfield" ID="Address2" Rows="6"
> > runat="server" TextMode="SingleLine" Width="200" /></td>
> > <td>&nbsp;</td>
> > </tr>
> > <tr>
> > <td align="right" nowrap class="Faqmaintext">Town:</td>
> > <td><asp:textbox CssClass="FRMfield" ID="Address3" Rows="6"
> > runat="server" TextMode="SingleLine" Width="200" /></td>
> > <td>&nbsp;</td>
> > </tr>
> > <tr>
> > <td align="right" nowrap class="Faqmaintext">Postcode:</td>
> > <td><asp:textbox CssClass="FRMfield" ID="postcode"
> > runat="server" TextMode="SingleLine" Width="200" />
> > *</td>
> > <td><asp:requiredfieldvalidator ControlToValidate="postcode"
> > Display="Dynamic" ErrorMessage="Required" Font-Name="Arial"
> > Font-Size="x-small" ID="rfvpostcode" runat="server" />&nbsp;</td>
> > </tr>
> > <tr>
> > <td align="right" nowrap class="Faqmaintext">&nbsp;</td>
> > <td>&nbsp;</td>
> > <td>&nbsp;</td>
> > </tr>
> > <tr>
> > <td></td>
> > <td height="30"><div align="left">
> > <div align="center"><asp:button ID="btn1" Text="Next
> > Step" runat="server" CssClass="FRMfield" OnClick="Page2_Visible"
> > ></asp:button></div>

> > </td>
> > <td></td>
> > </tr>
> > </table>
> > </td>
> > </tr>
> > </table>
> > </aspanel>
> > <aspanel runat="server" ID="panel2">
> > <span class="Faqmaintext"><strong><br>
> > User Details:<br>
> > </strong></span><span class="ORDsmallprint">Items
> > marked with * are compulsary.</span><br>
> > <table width="100%" border="0" align="center">
> > <tr>
> > <td align="right" nowrap class="Faqmaintext">Select
> > Username:</td>
> > <td><asp:textbox CssClass="FRMfield" ID="username"
> > runat="server" TextMode="SingleLine" Width="200" />
> > *</td>
> > <td><asp:requiredfieldvalidator ID="RequiredFieldValidator5"
> > Font-Size="x-small" Font-Name="Arial" EnableClientScript="true"
> > Display="Dynamic" ErrorMessage="Required" ControlToValidate="username"
> > runat="server" ></asp:requiredfieldvalidator></td>
> > </tr>
> > <tr>
> > <td colspan="3" align="right" nowrap
> > class="Faqmaintext">&nbsp;</td>
> > </tr>
> > <tr>
> > <td width="34%" align="right" nowrap
> > class="Faqmaintext"><b>Password:</b></td>
> > <td width="29%"><asp:textbox CssClass="FRMfield"
> > TextMode="Password" ID="Password" runat="server" Width="200"/>
> > *</td>
> > <td width="37%"><asp:requiredfieldvalidator
> > ID="RequiredFieldValidator6" Font-Size="x-small" Font-Name="Arial"
> > EnableClientScript="true" Display="Dynamic" ErrorMessage="Required"
> > ControlToValidate="Password"
> > runat="server"></asp:requiredfieldvalidator></td>
> > </tr>
> > <tr>
> > <td align="right" nowrap class="Faqmaintext"><b>Confirm
> > Password: </b></td>
> > <td><asp:textbox CssClass="FRMfield" TextMode="Password"
> > ID="PasswordConfirm" runat="server" Width="200" />
> > *</td>
> > <td><asp:requiredfieldvalidator ID="RequiredFieldValidator7"
> > Font-Size="x-small" Font-Name="Arial" EnableClientScript="true"
> > Display="Dynamic" ErrorMessage="Required"
> > ControlToValidate="PasswordConfirm"
> > runat="server"></asp:requiredfieldvalidator>
> > <asp:comparevalidator ControlToCompare="Password"
> > ID="CompareValidator1" Font-Size="x-small" Font-Name="Arial"
> > EnableClientScript="true" Display="Dynamic" ErrorMessage="Your
> > passwords do not match" ControlToValidate="PasswordConfirm"
> > runat="server"></asp:comparevalidator>
> > </td>
> > </tr>
> > <tr>
> > <td align="right" nowrap class="Faqmaintext">&nbsp;</td>
> > <td>&nbsp;</td>
> > <td>&nbsp;</td>
> > </tr>
> > <tr>
> > <td align="right" valign="top" nowrap
> > class="Faqmaintext">Contact Telephone
> > Number:</td>
> > <td><asp:textbox CssClass="FRMfield" TextMode="SingleLine"
> > ID="contact_num" runat="server" Width="200" />
> > *</td>
> > <td valign="top">&nbsp;</td>
> > </tr>
> > <tr>
> > <td align="right" nowrap class="Faqmaintext"><b>
> > E-mail:</b></td>
> > <td><asp:textbox CssClass="FRMfield" ID="EmailAddress"
> > runat="server" Width="200"/></td>
> > <td><asp:regularexpressionvalidator
> > ID="RegularExpressionValidator1" EnableClientScript="true"
> > Display="Dynamic" ErrorMessage="Please enter a valid email address"
> > ControlToValidate="EmailAddress"
> > ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
> > runat="server" Font-Size="x-small"
> > Font-Name="Arial"></asp:regularexpressionvalidator></td>
> > </tr>
> > <tr>
> > <td align="right" nowrap class="Faqmaintext">&nbsp;</td>
> > <td>&nbsp;</td>
> > <td>&nbsp;</td>
> > </tr>
> > <tr>
> > <td align="right" nowrap class="Faqmaintext">&nbsp;</td>
> > <td class="Faqmaintext"><div align="center"></div></td>
> > <td>&nbsp;</td>
> > </tr>
> > <tr>
> > <td height="80" colspan="3"><div align="center"
> > class="ORDsummary">
> > <p>Package Summary</p>
> > <p>You have selected
> > <font color="#FF0000">OPTION 1 (256k)</font> which wil
> > be charged at <font color="#FF0000">&pound;22</font> per month. <br>
> > Your Credit/Debit
> > card will be charged on the 15th of every month, one
> > month in
> > advance.<br>
> > Press the continue button to proceed to the payment
> > pages.</p>
> > </div></td>
> > </tr>
> > <tr>
> > <td align="right" nowrap class="Faqmaintext">&nbsp;</td>
> > <td>&nbsp; </td>
> > <td>&nbsp; </td>
> > </tr>
> > <tr>
> > <td height="19" colspan="3" class="ORDsmallprint"><div
> > align="center">By
> > pressing 'Continue', you agree to abide by the OPTIMUMi <a
> > href="#">Terms
> > and Conditions</a> of the Broadband service.</div>
> > </td>
> > </tr>
> > <tr>
> > <td class="Faqmaintext">&nbsp;</td>
> > <td height="30" align="right"><div align="center">
> > <asp:button runat="server" OnClick="Send_Email"
> > Text="Continue" CssClass="FRMfield"></asp:Button>
> > </div>
> > </td>
> > <td>&nbsp;</td>
> > </tr>
> > </table>
> > </aspanel>
> > </form>
> > </body>
> > </html>



 
Reply With Quote
 
Harry Singh
Guest
Posts: n/a
 
      11-10-2003
I dont think you missed anything, but I think you did clear up my
question.
The reason I was asking about session variables was to see if was needed
WITH aspanels, which I now assume you do not.

But then I am still left with the original problem, whereby only the 2nd
panel details are processed?
I have EnableViewState set to true on both my Panels as well as the
individual asp:textboxes (just to be sure), but this doesnt help either!

Any light you can shine this way would be appriciated!

Cheers
H




*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Swing, JTabbedPane/Panel/Panel JC Java 1 08-09-2006 09:44 PM
forms authentication -- expired forms cookie vs. not provided forms cookie Eric ASP .Net Security 2 01-27-2006 10:09 PM
Delete a panel inside a panel (2) HS1 Java 4 12-08-2004 02:48 AM
Delete a panel inside a panel HS1 Java 3 12-07-2004 10:50 PM
Getting email extractors to only extract one folder and not everything in the Outlook Express email program Jimchip Computer Support 18 06-29-2003 10:10 PM



Advertisments