Hello,
For some reason I cannot get this simple email form to work. The error points to RadComboBox, but I cannot see how to fix it. Please help me, my code is follows:
aspx.vb file:
For some reason I cannot get this simple email form to work. The error points to RadComboBox, but I cannot see how to fix it. Please help me, my code is follows:
<%@ Page Language="VB" MasterPageFile="~/oneColumnSlim.master" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="fastquote_Default" title="Untitled Page" %> |
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> |
<asp:Content ID="Content1" ContentPlaceHolderID="mid" Runat="Server"> |
<asp:Panel runat="server" ID="FastQuoteForm"> |
<asp:Image ID="Image1" runat="server" ImageUrl="http://www.deloosh.com.au/assets/email.png" CssClass="left" /> |
<h1>Contact Us</h1> |
<p>We are here to help. If you have a question about our service or your membership, |
please fill out the form below and click the submit button.</p> |
<p>For an instant answer, please make sure you have checked our <a href="../faqs/index.php"> |
Frequently asked Questions</a> (FAQs) section.</p> |
<table style="width:100%;" cellpadding="5px"> |
<tr> |
<td align="right">Title </td> |
<td> |
<telerik:RadComboBox ID="Title" runat="server" |
ToolTip="Please enter your title" Skin="WebBlue" Text="Title" |
AutoPostBack="True"> |
<Items> |
<telerik:RadComboBoxItem runat="server" Text="Mr" Value="Mr" /> |
<telerik:RadComboBoxItem runat="server" Text="Mrs" Value="Mrs" /> |
<telerik:RadComboBoxItem runat="server" Text="Miss" Value="Miss" /> |
<telerik:RadComboBoxItem runat="server" Text="Ms" Value="Ms" /> |
<telerik:RadComboBoxItem runat="server" Text="Dr" Value="Dr" ToolTip="Please give your title" /> |
<telerik:RadComboBoxItem runat="server" Text="Prof" Value="Prof" /> |
</Items> |
<CollapseAnimation Duration="200" Type="OutQuint" /> |
</telerik:RadComboBox> |
<asp:RequiredFieldValidator |
ID="RequiredFieldValidator1" runat="server" ControlToValidate="Title" |
ErrorMessage="You need to give your title" |
ValidationGroup="MessageGroup"> </asp:RequiredFieldValidator> </td> |
</tr> |
<tr> |
<td align="right">First name </td> |
<td> |
<telerik:RadTextBox ID="FirstName" runat="server"> |
</telerik:RadTextBox> <asp:RequiredFieldValidator |
ID="RequiredFieldValidator9" runat="server" ControlToValidate="Message" |
ErrorMessage="Please enter your message" |
ValidationGroup="MessageGroup"></asp:RequiredFieldValidator></td> |
</tr> |
<tr> |
<td align="right">Last name </td> |
<td> |
<telerik:RadTextBox ID="LastName" Runat="server" Label="" Rows="10" |
Skin="Telerik" ToolTip="Enter your last name" |
Width="250px" Wrap="True"> </telerik:RadTextBox> |
<asp:RequiredFieldValidator |
ID="RequiredFieldValidator3" runat="server" ControlToValidate="LastName" |
ErrorMessage="Please enter your last name" |
ValidationGroup="MessageGroup"></asp:RequiredFieldValidator> |
</td> |
</tr> |
<tr> |
<td align="right">Company </td> |
<td><telerik:RadTextBox ID="Company" runat="server"> |
</telerik:RadTextBox> <asp:RequiredFieldValidator |
ID="RequiredFieldValidator2" runat="server" ControlToValidate="Company" |
ErrorMessage="Please enter your company" |
ValidationGroup="MessageGroup"></asp:RequiredFieldValidator></td> |
</tr> |
<tr> |
<td align="right">Telephone </td> |
<td><telerik:RadTextBox ID="Telephone" runat="server"> |
</telerik:RadTextBox> <asp:RequiredFieldValidator |
ID="RequiredFieldValidator4" runat="server" ControlToValidate="Telephone" |
ErrorMessage="Please enter your telephone number" |
ValidationGroup="MessageGroup"></asp:RequiredFieldValidator></td> |
</tr> |
<tr> |
<td align="right">Email </td> |
<td><telerik:RadTextBox ID="Email" Runat="server" Label="" Skin="Telerik" |
ToolTip="Enter your email" Width="190px"> </telerik:RadTextBox> |
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" |
ErrorMessage="Invalid email address" ControlToValidate="Email" |
ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" |
ValidationGroup="MessageGroup"></asp:RegularExpressionValidator></td> |
</tr> |
<tr> |
<td align="right">Required Services </td> |
<td> |
<asp:CheckBoxList ID="Services" runat="server" ToolTip="Choose which services you require"> |
<asp:ListItem>Advanced research design</asp:ListItem> |
<asp:ListItem>Survey programming</asp:ListItem> |
<asp:ListItem>Survey hosting</asp:ListItem> |
<asp:ListItem>Panel respondents</asp:ListItem> |
<asp:ListItem>Data analysis</asp:ListItem> |
</asp:CheckBoxList> |
</td> |
</tr> |
<tr> |
<td align="right">Number of questions </td> |
<td><telerik:RadTextBox ID="QuestionNo" runat="server"> |
</telerik:RadTextBox> <asp:RequiredFieldValidator |
ID="RequiredFieldValidator8" runat="server" ControlToValidate="QuestionNo" |
ErrorMessage="Please enter the number of questions" |
ValidationGroup="MessageGroup"></asp:RequiredFieldValidator></td> |
</tr> |
<tr> |
<td align="right">Number of responses needed </td> |
<td><telerik:RadTextBox ID="ResponseNo" runat="server"> |
</telerik:RadTextBox> <asp:RequiredFieldValidator |
ID="RequiredFieldValidator5" runat="server" ControlToValidate="ResponseNo" |
ErrorMessage="Please enter the number of responses" |
ValidationGroup="MessageGroup"></asp:RequiredFieldValidator></td> |
</tr> |
<tr> |
<td align="right">Target demographic </td> |
<td><telerik:RadTextBox ID="Demographic" runat="server"> |
</telerik:RadTextBox> |
</td> |
</tr> |
<tr> |
<td align="right">Other information </td> |
<td><telerik:RadTextBox ID="OtherInfo" runat="server" TextMode="MultiLine"> |
</telerik:RadTextBox> </td> |
</tr> |
<tr> |
<td align="right"> </td> |
<td><telerik:RadTextBox ID="Promo" runat="server"> |
</telerik:RadTextBox> </td> |
</tr> |
<tr> |
<td align="right"> </td> |
<td> </td> |
</tr> |
<tr> |
<td align="right"> </td> |
<td> </td> |
</tr> |
<tr> |
<td align="right"> </td> |
<td> </td> |
</tr> |
<tr> |
<td align="right"> </td> |
<td> </td> |
</tr> |
<tr> |
<td align="right"> </td> |
<td> </td> |
</tr> |
<tr> |
<td align="right"> </td> |
<td> </td> |
</tr> |
</table> |
<br /> |
<br /> |
<asp:ImageButton |
ID="SendEmail" runat="server" ImageUrl="http://www.deloosh.com.au/assets/red-button-send.jpg" CausesValidation="true" ValidationGroup="MessageGroup" CssClass="rightButton" /> |
</asp:Panel> |
<asp:Panel runat="server" ID="FastQuoteSentForm"> |
Your feedback has been sent. If needed, we will respond as soon as we can. Thank |
you for your interest in AussieThink. |
</asp:Panel> |
<div class="privacy"> |
<asp:Image ID="Image2" runat="server" ImageUrl="http://www.deloosh.com.au/assets/mail.png" /> |
style="width: 63px; height: 41px" />Corporate: Suite 5, Manchester Lane, |
Parkville, VIC 3052 |
</div> |
</asp:Content> |
aspx.vb file:
Imports System.Net.Mail |
Imports System.Net |
Partial Class fastquote_Default |
Inherits System.Web.UI.Page |
Protected Sub SendEmail_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles SendEmail.Click |
'!!! UPDATE THIS VALUE TO YOUR EMAIL ADDRESS |
Const ToAddress As String = "brent.coker@gmail.com" |
'(1) Create the MailMessage instance |
Dim mm As New MailMessage(Email.Text, ToAddress) |
'(2) Assign the MailMessage's properties |
mm.Subject = Services.Text |
mm.IsBodyHtml = True |
mm.Body = _ |
"<html><head><title>" & _ |
HttpUtility.HtmlEncode(Title.Text) & _ |
"</title></head><body>" & _ |
"<p>" & _ |
HttpUtility.HtmlEncode(FirstName.Text) & "</p>" & _ |
"<p>Employee of the month: " & _ |
HttpUtility.HtmlEncode(LastName.Text) & "</p>" & _ |
"<p>This month's featured event: " & _ |
HttpUtility.HtmlEncode(Company.Text) & "</p>" & _ |
"<p>" & _ |
HttpUtility.HtmlEncode(Telephone.Text) & "</p>" & _ |
"<p>Employee of the month: " & _ |
HttpUtility.HtmlEncode(Email.Text) & "</p>" & _ |
"<p>This month's featured event: " & _ |
HttpUtility.HtmlEncode(Company.Text) & "</p>" & _ |
"<p>" & _ |
HttpUtility.HtmlEncode(Services.Text) & "</p>" & _ |
"<p>Employee of the month: " & _ |
HttpUtility.HtmlEncode(QuestionNo.Text) & "</p>" & _ |
"<p>This month's featured event: " & _ |
HttpUtility.HtmlEncode(ResponseNo.Text) & "</p>" & _ |
"<p>" & _ |
HttpUtility.HtmlEncode(Demographic.Text) & "</p>" & _ |
"<p>Employee of the month: " & _ |
HttpUtility.HtmlEncode(OtherInfo.Text) & "</p>" & _ |
"<p>This month's featured event: " & _ |
HttpUtility.HtmlEncode(Promo.Text) & "</p>" & _ |
"</body></html>" |
'(3) Create the SmtpClient object |
Dim smtp As New SmtpClient |
'(4) Send the MailMessage (will use the Web.config settings) |
smtp.Send(mm) |
'Show the EmailSentForm Panel and hide the EmailForm Panel |
FastQuoteSentForm.Visible = True |
FastQuoteForm.Visible = False |
End Sub |
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load |
If Not Page.IsPostBack Then |
'On the first page load, hide the EmailSentForm Panel |
FastQuoteSentForm.Visible = False |
End If |
End Sub |
End Class |