0

Hi, I'm a newbie, having problems creating a feedback form that will be sent to me via email after the client fills it out, any help would be great! When I choose ctrl f5 to take a look and test, I'm getting the below error message:

A page can have only one server-side Form tag.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: A page can have only one server-side Form tag.


here's my code, any help would be highly appreciated!

user control code:

<%@ Control Language="VB" AutoEventWireup="false" CodeFile="BookYourParty.ascx.vb" Inherits="BookYourParty" %>
<style type="text/css">

        .style1
        {
            width: 100%;
        }
        .style6
    {
        height: 76px;
    }
        .style3
        {
            width: 491px;
        }
        .style4
        {
            width: 315px;
        }
    .style5
    {
    }
</style>
    <form id="form1" runat="server">
    <div>
    
        <table class="style1">
            <tr>
                <td colspan="2" style="font-weight: 700">
                    Book Your Party!</td>
            </tr>
            <tr>
                <td class="style6" colspan="2">
                    <asp:Menu ID="Menu1" runat="server" BackColor="#F7F6F3" 
                        DynamicHorizontalOffset="2" Font-Names="Verdana" Font-Size="0.8em" 
                        ForeColor="#7C6F57" Height="21px" Orientation="Horizontal" 
                        StaticEnableDefaultPopOutImage="False" StaticSubMenuIndent="10px" 
                        style="text-align: center" Width="364px">
                        <StaticSelectedStyle BackColor="#5D7B9D" />
                        <StaticMenuItemStyle HorizontalPadding="5px" ItemSpacing="10px" 
                            VerticalPadding="2px" />
                        <DynamicHoverStyle BackColor="#7C6F57" ForeColor="White" />
                        <DynamicMenuStyle BackColor="#F7F6F3" />
                        <DynamicSelectedStyle BackColor="#5D7B9D" />
                        <DynamicMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
                        <StaticHoverStyle BackColor="#7C6F57" ForeColor="White" />
                        <Items>
                            <asp:MenuItem NavigateUrl="~/AboutUs.aspx" Text="About Us" Value="About Us">
                            </asp:MenuItem>
                            <asp:MenuItem NavigateUrl="~/Services.aspx" Text="Services" Value="Services">
                                <asp:MenuItem NavigateUrl="~/ConciergeServices.aspx" Text="Conceirge Services" 
                                    Value="Conceirge Services"></asp:MenuItem>
                            </asp:MenuItem>
                            <asp:MenuItem NavigateUrl="~/Calendar.aspx" Text="Calendar" Value="Calendar">
                            </asp:MenuItem>
                            <asp:MenuItem NavigateUrl="~/ContactUs.aspx" Text="Contact Us" 
                                Value="Contact Us">
                                <asp:MenuItem NavigateUrl="~/BookYourParty.aspx" Text="Book Your Party" 
                                    Value="Book Your Party"></asp:MenuItem>
                                <asp:MenuItem NavigateUrl="~/CustomerFeedback.aspx" Text="Customer Feedback" 
                                    Value="Customer Feedback"></asp:MenuItem>
                                <asp:MenuItem NavigateUrl="~/EmploymentContractoropp.aspx" 
                                    Text="Employment - Contractor Opportunities" 
                                    Value="Employment - Contractor Opportunities"></asp:MenuItem>
                                <asp:MenuItem NavigateUrl="~/GeneralInquiry.aspx" Text="General Inquiry" 
                                    Value="General Inquiry"></asp:MenuItem>
                            </asp:MenuItem>
                            <asp:MenuItem NavigateUrl="~/PhotoGallery.aspx" Text="Photo Gallery" 
                                Value="Photo Gallery"></asp:MenuItem>
                            <asp:MenuItem NavigateUrl="~/Testimony.aspx" Text="Testimony" Value="Testimony">
                            </asp:MenuItem>
                            <asp:MenuItem NavigateUrl="~/Videos.aspx" Text="Videos" Value="Videos">
                            </asp:MenuItem>
                            <asp:MenuItem NavigateUrl="~/ClientLogin.aspx" Text="Client Login" 
                                Value="Client Login"></asp:MenuItem>
                            <asp:MenuItem NavigateUrl="~/FAQs.aspx" Text="FAQs" Value="FAQs"></asp:MenuItem>
                        </Items>
                    </asp:Menu>
                </td>
            </tr>
            <tr>
                <td class="style6" colspan="2">
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style6" colspan="2">
                    Please complete this form and we will get in touch with you within 24 hours.</td>
            </tr>
            <tr>
                <td class="style3">
                    <asp:Label ID="Label1" runat="server" Text="contact name"></asp:Label>
                    <asp:TextBox ID="TextBox1" runat="server" AutoCompleteType="FirstName" 
                        MaxLength="15"></asp:TextBox>
                    <asp:TextBox ID="TextBox2" runat="server" AutoCompleteType="LastName"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                        ControlToValidate="TextBox1" ErrorMessage="Please enter your first name">*</asp:RequiredFieldValidator>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" 
                        ControlToValidate="TextBox2" ErrorMessage="Please enter your last name">*</asp:RequiredFieldValidator>
                </td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style1">
                    <asp:Label ID="Label2" runat="server" Text="telephone"></asp:Label>
                    <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
                    <asp:Label ID="Label3" runat="server" Text="best time to call:"></asp:Label>
                    <asp:DropDownList ID="DropDownList1" runat="server">
                        <asp:ListItem>morning</asp:ListItem>
                        <asp:ListItem>noon</asp:ListItem>
                        <asp:ListItem>afternoon</asp:ListItem>
                        <asp:ListItem>evening</asp:ListItem>
                    </asp:DropDownList>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                        ControlToValidate="TextBox3" ErrorMessage="Please enter your phone number">*</asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
                        ControlToValidate="TextBox3" ErrorMessage="Please enter your telephone number" 
                        ValidationExpression="((\(\d{3}\) ?)|(\d{3}-))?\d{3}-\d{4}">*</asp:RegularExpressionValidator>
                    <asp:CustomValidator ID="CustomValidator1" runat="server" 
                        ClientValidationFunction="ValidatePhoneNumbers" Display="Dynamic" 
                        ErrorMessage="Please enter your telephone number">*</asp:CustomValidator>
                </td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style1">
                    <asp:Label ID="Label4" runat="server" Text="email address"></asp:Label>
                    <asp:TextBox ID="TextBox4" runat="server" Width="313px"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" 
                        ControlToValidate="TextBox4" ErrorMessage="Please enter your email address">*</asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" 
                        ControlToValidate="TextBox4" ErrorMessage="Please enter valid email address" 
                        ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">*</asp:RegularExpressionValidator>
                    <asp:CustomValidator ID="CustomValidator2" runat="server" 
                        ErrorMessage="Please enter your email address" 
                        ControlToValidate="TextBox4" Display="Dynamic">*</asp:CustomValidator>
                </td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style1">
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
        </table>
    
    </div>
    <div>
    <script type="text/javascript">
    function ValidatePhoneNumbers(source, args)
    {
    var textbox3=document.getElementById('<%= textbox3.ClientID %>');
    {
    args.IsValid = true;
    }
    }
    </script>
        <table class="style1">
            <tr>
                <td class="style3">
                    About your event:</td>
                <td>
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style3">
                    <asp:Label ID="Label5" runat="server" Text="number of guests:"></asp:Label>
                    <asp:DropDownList ID="DropDownList3" runat="server">
                        <asp:ListItem>less than 25</asp:ListItem>
                        <asp:ListItem>25 to 50</asp:ListItem>
                        <asp:ListItem>50 to 100</asp:ListItem>
                        <asp:ListItem>100 to 150</asp:ListItem>
                        <asp:ListItem>150 to 200</asp:ListItem>
                        <asp:ListItem>more than 200</asp:ListItem>
                    </asp:DropDownList>
                </td>
                <td>
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style3">
                    <asp:Label ID="Label6" runat="server" Text="event type:"></asp:Label>
                    <asp:DropDownList ID="DropDownList4" runat="server">
                        <asp:ListItem>holiday party</asp:ListItem>
                        <asp:ListItem>birthday party</asp:ListItem>
                        <asp:ListItem>private house party</asp:ListItem>
                        <asp:ListItem>wedding</asp:ListItem>
                        <asp:ListItem>corporate </asp:ListItem>
                        <asp:ListItem>bachelor/ette party</asp:ListItem>
                        <asp:ListItem>other</asp:ListItem>
                    </asp:DropDownList>
                </td>
                <td>
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style3">
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style3">
                    <asp:Label ID="Label8" runat="server" Text="event date and time:"></asp:Label>
                    <asp:DropDownList ID="DropDownList5" runat="server">
                        <asp:ListItem>mm/dd/yyyy</asp:ListItem>
                    </asp:DropDownList>
                </td>
                <td>
                    <asp:Label ID="Label9" runat="server" Text="length:"></asp:Label>
                    <asp:DropDownList ID="DropDownList2" runat="server" Height="19px" Width="160px">
                        <asp:ListItem>4 hours (minimum)</asp:ListItem>
                        <asp:ListItem>5 hours</asp:ListItem>
                        <asp:ListItem>6 hours</asp:ListItem>
                        <asp:ListItem>7 hours</asp:ListItem>
                        <asp:ListItem>8 hours</asp:ListItem>
                        <asp:ListItem>more than 8 hours</asp:ListItem>
                    </asp:DropDownList>
                </td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style3">
                    <asp:Label ID="Label10" runat="server" Text="venue contact info:"></asp:Label>
                    <asp:TextBox ID="TextBox10" runat="server" Width="331px" MaxLength="15"></asp:TextBox>
                </td>
                <td>
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
        </table>
    </div>
    <div>
    
        <table class="style1">
            <tr>
                <td class="style4">
                    Special requirements:</td>
                <td>
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style4">
                    <asp:CheckBox ID="CheckBox1" runat="server" Text="glassware rental" />
                </td>
                <td>
                    <asp:CheckBox ID="CheckBox3" runat="server" Text="decorations" />
                </td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style4">
                    <asp:CheckBox ID="CheckBox2" runat="server" Text="portable bar rental" />
                </td>
                <td>
                    <asp:CheckBox ID="CheckBox4" runat="server" Text="other:" />
                    <asp:TextBox ID="TextBox11" runat="server" Width="427px"></asp:TextBox>
                </td>
                <td>
                    &nbsp;</td>
            </tr>
        </table>
    
    </div>
    <div>
    
        <table class="style1" runat="server" id="FormTable">
            <tr>
                <td class="style5">
                    Additional Information / Comments:</td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style5">
                    &nbsp;</td>
                <td>
                    <asp:TextBox ID="TextBox12" runat="server" Height="169px" MaxLength="30" 
                        Width="410px"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" 
                        ControlToValidate="TextBox12" ErrorMessage="Please enter a comment">*</asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td class="style5">
                    &nbsp;</td>
                <td>
                    <input type="reset" value="clear form" />
                    <input type="submit" value="request info/quote" />
                    
                </td>
            </tr>
            <tr>
                <td class="style5" colspan="2">
                    <asp:ValidationSummary ID="ValidationSummary1" runat="server" />
                </td>
            </tr>
        </table>
        <asp:Label ID="lblMessage" runat="server" Text="Message Sent" Visible="false"></asp:Label>
    
    </div>
    </form>

Code Behind:

Imports System.Net.Mail
Partial Class BookYourParty
    Inherits System.Web.UI.UserControl

    Protected Sub CustomValidator1_ServerValidate(ByVal source As Object, ByVal args As System.Web.UI.WebControls.ServerValidateEventArgs) Handles CustomValidator1.ServerValidate
        If TextBox3.Text IsNot String.Empty Then args.IsValid = True 
        args.IsValid = False
    End Sub
    Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        If Page.IsValid Then
            Dim filename As String = Server.MapPath("~/App_Data/BookYourParty.txt")
            Dim mailbody As String = System.IO.File.ReadAllText(filename)

            mailbody = mailbody.Replace("##FirstName##", TextBox1.Text)
            mailbody = mailbody.Replace("##LastName##", TextBox2.Text)
            mailbody = mailbody.Replace("##HomePhone##", TextBox3.Text)
            mailbody = mailbody.Replace("##Email##", TextBox4.Text)
            mailbody = mailbody.Replace("##BestTimeToCall##", DropDownList1.SelectedValue)
            mailbody = mailbody.Replace("##NumberOfGuests##", DropDownList3.SelectedValue)
            mailbody = mailbody.Replace("##EventType##", DropDownList4.Text)
            mailbody = mailbody.Replace("##EventDateandTime##", DropDownList5.SelectedValue)
            mailbody = mailbody.Replace("##Length##", DropDownList2.SelectedValue)
            mailbody = mailbody.Replace("##VenueContactInfo##", TextBox10.Text)
            mailbody = mailbody.Replace("##GlasswareRental##", CheckBox1.Checked)
            mailbody = mailbody.Replace("##PortableBarRental##", CheckBox2.Checked)
            mailbody = mailbody.Replace("##Decorations##", CheckBox3.Checked)
            mailbody = mailbody.Replace("##Other##", CheckBox4.Checked)
            mailbody = mailbody.Replace("##AdditionalInformationComments##", TextBox12.Text)

            Dim myMessage As MailMessage = New MailMessage()
            myMessage.Subject = "Response from web site"
            myMessage.Body = mailbody

            myMessage.From = New MailAddress("contact@b-royaldesigns.com", "Sender Name Here")
            myMessage.To.Add(New MailAddress("contact@b-royaldesigns.com", "Receiver Name Here"))

            Dim mySmtpClient As SmtpClient = New SmtpClient()
            mySmtpClient.Send(myMessage)

            lblMessage.Visible = True
            FormTable.Visible = False
        End If
    End Sub
End Class

Page of Code where User control is inserted:

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="BookYourParty.aspx.vb" Inherits="BookYourParty" %>

<%@ Register src="BookYourParty.ascx" tagname="BookYourParty" tagprefix="uc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style type="text/css">
        .style1
        {
            width: 100%;
        }
        .style2
        {
        }
        .style3
        {
            width: 491px;
        }
        .style4
        {
            width: 315px;
        }
        .style5
        {
            width: 233px;
        }
        .style6
        {
            height: 76px;
        }
    </style>
</head>
<body>
    
    <form id="form1" runat="server">
    <uc1:BookYourParty ID="BookYourParty1" runat="server" />
    </form>
    
    </body>
</html>

Edited by __avd: Added [code] tags. Encase your code in: [code] and [/code] tags.

2
Contributors
4
Replies
13
Views
7 Years
Discussion Span
Last Post by abby524
0

Hi, I'm a newbie, having problems creating a feedback form that will be sent to me via email after the client fills it out, any help would be great! When I choose ctrl f5 to take a look and test, I'm getting the below error message:

A page can have only one server-side Form tag.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: A page can have only one server-side Form tag.


here's my code, any help would be highly appreciated!

user control code:

<%@ Control Language="VB" AutoEventWireup="false" CodeFile="BookYourParty.ascx.vb" Inherits="BookYourParty" %>
<style type="text/css">

        .style1
        {
            width: 100%;
        }
        .style6
    {
        height: 76px;
    }
        .style3
        {
            width: 491px;
        }
        .style4
        {
            width: 315px;
        }
    .style5
    {
    }
</style>
    <form id="form1" runat="server">
    <div>
    
        <table class="style1">
            <tr>
                <td colspan="2" style="font-weight: 700">
                    Book Your Party!</td>
            </tr>
            <tr>
                <td class="style6" colspan="2">
                    <asp:Menu ID="Menu1" runat="server" BackColor="#F7F6F3" 
                        DynamicHorizontalOffset="2" Font-Names="Verdana" Font-Size="0.8em" 
                        ForeColor="#7C6F57" Height="21px" Orientation="Horizontal" 
                        StaticEnableDefaultPopOutImage="False" StaticSubMenuIndent="10px" 
                        style="text-align: center" Width="364px">
                        <StaticSelectedStyle BackColor="#5D7B9D" />
                        <StaticMenuItemStyle HorizontalPadding="5px" ItemSpacing="10px" 
                            VerticalPadding="2px" />
                        <DynamicHoverStyle BackColor="#7C6F57" ForeColor="White" />
                        <DynamicMenuStyle BackColor="#F7F6F3" />
                        <DynamicSelectedStyle BackColor="#5D7B9D" />
                        <DynamicMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
                        <StaticHoverStyle BackColor="#7C6F57" ForeColor="White" />
                        <Items>
                            <asp:MenuItem NavigateUrl="~/AboutUs.aspx" Text="About Us" Value="About Us">
                            </asp:MenuItem>
                            <asp:MenuItem NavigateUrl="~/Services.aspx" Text="Services" Value="Services">
                                <asp:MenuItem NavigateUrl="~/ConciergeServices.aspx" Text="Conceirge Services" 
                                    Value="Conceirge Services"></asp:MenuItem>
                            </asp:MenuItem>
                            <asp:MenuItem NavigateUrl="~/Calendar.aspx" Text="Calendar" Value="Calendar">
                            </asp:MenuItem>
                            <asp:MenuItem NavigateUrl="~/ContactUs.aspx" Text="Contact Us" 
                                Value="Contact Us">
                                <asp:MenuItem NavigateUrl="~/BookYourParty.aspx" Text="Book Your Party" 
                                    Value="Book Your Party"></asp:MenuItem>
                                <asp:MenuItem NavigateUrl="~/CustomerFeedback.aspx" Text="Customer Feedback" 
                                    Value="Customer Feedback"></asp:MenuItem>
                                <asp:MenuItem NavigateUrl="~/EmploymentContractoropp.aspx" 
                                    Text="Employment - Contractor Opportunities" 
                                    Value="Employment - Contractor Opportunities"></asp:MenuItem>
                                <asp:MenuItem NavigateUrl="~/GeneralInquiry.aspx" Text="General Inquiry" 
                                    Value="General Inquiry"></asp:MenuItem>
                            </asp:MenuItem>
                            <asp:MenuItem NavigateUrl="~/PhotoGallery.aspx" Text="Photo Gallery" 
                                Value="Photo Gallery"></asp:MenuItem>
                            <asp:MenuItem NavigateUrl="~/Testimony.aspx" Text="Testimony" Value="Testimony">
                            </asp:MenuItem>
                            <asp:MenuItem NavigateUrl="~/Videos.aspx" Text="Videos" Value="Videos">
                            </asp:MenuItem>
                            <asp:MenuItem NavigateUrl="~/ClientLogin.aspx" Text="Client Login" 
                                Value="Client Login"></asp:MenuItem>
                            <asp:MenuItem NavigateUrl="~/FAQs.aspx" Text="FAQs" Value="FAQs"></asp:MenuItem>
                        </Items>
                    </asp:Menu>
                </td>
            </tr>
            <tr>
                <td class="style6" colspan="2">
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style6" colspan="2">
                    Please complete this form and we will get in touch with you within 24 hours.</td>
            </tr>
            <tr>
                <td class="style3">
                    <asp:Label ID="Label1" runat="server" Text="contact name"></asp:Label>
                    <asp:TextBox ID="TextBox1" runat="server" AutoCompleteType="FirstName" 
                        MaxLength="15"></asp:TextBox>
                    <asp:TextBox ID="TextBox2" runat="server" AutoCompleteType="LastName"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                        ControlToValidate="TextBox1" ErrorMessage="Please enter your first name">*</asp:RequiredFieldValidator>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" 
                        ControlToValidate="TextBox2" ErrorMessage="Please enter your last name">*</asp:RequiredFieldValidator>
                </td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style1">
                    <asp:Label ID="Label2" runat="server" Text="telephone"></asp:Label>
                    <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
                    <asp:Label ID="Label3" runat="server" Text="best time to call:"></asp:Label>
                    <asp:DropDownList ID="DropDownList1" runat="server">
                        <asp:ListItem>morning</asp:ListItem>
                        <asp:ListItem>noon</asp:ListItem>
                        <asp:ListItem>afternoon</asp:ListItem>
                        <asp:ListItem>evening</asp:ListItem>
                    </asp:DropDownList>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                        ControlToValidate="TextBox3" ErrorMessage="Please enter your phone number">*</asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
                        ControlToValidate="TextBox3" ErrorMessage="Please enter your telephone number" 
                        ValidationExpression="((\(\d{3}\) ?)|(\d{3}-))?\d{3}-\d{4}">*</asp:RegularExpressionValidator>
                    <asp:CustomValidator ID="CustomValidator1" runat="server" 
                        ClientValidationFunction="ValidatePhoneNumbers" Display="Dynamic" 
                        ErrorMessage="Please enter your telephone number">*</asp:CustomValidator>
                </td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style1">
                    <asp:Label ID="Label4" runat="server" Text="email address"></asp:Label>
                    <asp:TextBox ID="TextBox4" runat="server" Width="313px"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" 
                        ControlToValidate="TextBox4" ErrorMessage="Please enter your email address">*</asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" 
                        ControlToValidate="TextBox4" ErrorMessage="Please enter valid email address" 
                        ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">*</asp:RegularExpressionValidator>
                    <asp:CustomValidator ID="CustomValidator2" runat="server" 
                        ErrorMessage="Please enter your email address" 
                        ControlToValidate="TextBox4" Display="Dynamic">*</asp:CustomValidator>
                </td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style1">
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
        </table>
    
    </div>
    <div>
    <script type="text/javascript">
    function ValidatePhoneNumbers(source, args)
    {
    var textbox3=document.getElementById('<%= textbox3.ClientID %>');
    {
    args.IsValid = true;
    }
    }
    </script>
        <table class="style1">
            <tr>
                <td class="style3">
                    About your event:</td>
                <td>
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style3">
                    <asp:Label ID="Label5" runat="server" Text="number of guests:"></asp:Label>
                    <asp:DropDownList ID="DropDownList3" runat="server">
                        <asp:ListItem>less than 25</asp:ListItem>
                        <asp:ListItem>25 to 50</asp:ListItem>
                        <asp:ListItem>50 to 100</asp:ListItem>
                        <asp:ListItem>100 to 150</asp:ListItem>
                        <asp:ListItem>150 to 200</asp:ListItem>
                        <asp:ListItem>more than 200</asp:ListItem>
                    </asp:DropDownList>
                </td>
                <td>
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style3">
                    <asp:Label ID="Label6" runat="server" Text="event type:"></asp:Label>
                    <asp:DropDownList ID="DropDownList4" runat="server">
                        <asp:ListItem>holiday party</asp:ListItem>
                        <asp:ListItem>birthday party</asp:ListItem>
                        <asp:ListItem>private house party</asp:ListItem>
                        <asp:ListItem>wedding</asp:ListItem>
                        <asp:ListItem>corporate </asp:ListItem>
                        <asp:ListItem>bachelor/ette party</asp:ListItem>
                        <asp:ListItem>other</asp:ListItem>
                    </asp:DropDownList>
                </td>
                <td>
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style3">
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style3">
                    <asp:Label ID="Label8" runat="server" Text="event date and time:"></asp:Label>
                    <asp:DropDownList ID="DropDownList5" runat="server">
                        <asp:ListItem>mm/dd/yyyy</asp:ListItem>
                    </asp:DropDownList>
                </td>
                <td>
                    <asp:Label ID="Label9" runat="server" Text="length:"></asp:Label>
                    <asp:DropDownList ID="DropDownList2" runat="server" Height="19px" Width="160px">
                        <asp:ListItem>4 hours (minimum)</asp:ListItem>
                        <asp:ListItem>5 hours</asp:ListItem>
                        <asp:ListItem>6 hours</asp:ListItem>
                        <asp:ListItem>7 hours</asp:ListItem>
                        <asp:ListItem>8 hours</asp:ListItem>
                        <asp:ListItem>more than 8 hours</asp:ListItem>
                    </asp:DropDownList>
                </td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style3">
                    <asp:Label ID="Label10" runat="server" Text="venue contact info:"></asp:Label>
                    <asp:TextBox ID="TextBox10" runat="server" Width="331px" MaxLength="15"></asp:TextBox>
                </td>
                <td>
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
        </table>
    </div>
    <div>
    
        <table class="style1">
            <tr>
                <td class="style4">
                    Special requirements:</td>
                <td>
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style4">
                    <asp:CheckBox ID="CheckBox1" runat="server" Text="glassware rental" />
                </td>
                <td>
                    <asp:CheckBox ID="CheckBox3" runat="server" Text="decorations" />
                </td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style4">
                    <asp:CheckBox ID="CheckBox2" runat="server" Text="portable bar rental" />
                </td>
                <td>
                    <asp:CheckBox ID="CheckBox4" runat="server" Text="other:" />
                    <asp:TextBox ID="TextBox11" runat="server" Width="427px"></asp:TextBox>
                </td>
                <td>
                    &nbsp;</td>
            </tr>
        </table>
    
    </div>
    <div>
    
        <table class="style1" runat="server" id="FormTable">
            <tr>
                <td class="style5">
                    Additional Information / Comments:</td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style5">
                    &nbsp;</td>
                <td>
                    <asp:TextBox ID="TextBox12" runat="server" Height="169px" MaxLength="30" 
                        Width="410px"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" 
                        ControlToValidate="TextBox12" ErrorMessage="Please enter a comment">*</asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td class="style5">
                    &nbsp;</td>
                <td>
                    <input type="reset" value="clear form" />
                    <input type="submit" value="request info/quote" />
                    
                </td>
            </tr>
            <tr>
                <td class="style5" colspan="2">
                    <asp:ValidationSummary ID="ValidationSummary1" runat="server" />
                </td>
            </tr>
        </table>
        <asp:Label ID="lblMessage" runat="server" Text="Message Sent" Visible="false"></asp:Label>
    
    </div>
    </form>

Code Behind:

Imports System.Net.Mail
Partial Class BookYourParty
    Inherits System.Web.UI.UserControl

    Protected Sub CustomValidator1_ServerValidate(ByVal source As Object, ByVal args As System.Web.UI.WebControls.ServerValidateEventArgs) Handles CustomValidator1.ServerValidate
        If TextBox3.Text IsNot String.Empty Then args.IsValid = True 
        args.IsValid = False
    End Sub
    Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        If Page.IsValid Then
            Dim filename As String = Server.MapPath("~/App_Data/BookYourParty.txt")
            Dim mailbody As String = System.IO.File.ReadAllText(filename)

            mailbody = mailbody.Replace("##FirstName##", TextBox1.Text)
            mailbody = mailbody.Replace("##LastName##", TextBox2.Text)
            mailbody = mailbody.Replace("##HomePhone##", TextBox3.Text)
            mailbody = mailbody.Replace("##Email##", TextBox4.Text)
            mailbody = mailbody.Replace("##BestTimeToCall##", DropDownList1.SelectedValue)
            mailbody = mailbody.Replace("##NumberOfGuests##", DropDownList3.SelectedValue)
            mailbody = mailbody.Replace("##EventType##", DropDownList4.Text)
            mailbody = mailbody.Replace("##EventDateandTime##", DropDownList5.SelectedValue)
            mailbody = mailbody.Replace("##Length##", DropDownList2.SelectedValue)
            mailbody = mailbody.Replace("##VenueContactInfo##", TextBox10.Text)
            mailbody = mailbody.Replace("##GlasswareRental##", CheckBox1.Checked)
            mailbody = mailbody.Replace("##PortableBarRental##", CheckBox2.Checked)
            mailbody = mailbody.Replace("##Decorations##", CheckBox3.Checked)
            mailbody = mailbody.Replace("##Other##", CheckBox4.Checked)
            mailbody = mailbody.Replace("##AdditionalInformationComments##", TextBox12.Text)

            Dim myMessage As MailMessage = New MailMessage()
            myMessage.Subject = "Response from web site"
            myMessage.Body = mailbody

            myMessage.From = New MailAddress("contact@b-royaldesigns.com", "Sender Name Here")
            myMessage.To.Add(New MailAddress("contact@b-royaldesigns.com", "Receiver Name Here"))

            Dim mySmtpClient As SmtpClient = New SmtpClient()
            mySmtpClient.Send(myMessage)

            lblMessage.Visible = True
            FormTable.Visible = False
        End If
    End Sub
End Class

Page of Code where User control is inserted:

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="BookYourParty.aspx.vb" Inherits="BookYourParty" %>

<%@ Register src="BookYourParty.ascx" tagname="BookYourParty" tagprefix="uc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style type="text/css">
        .style1
        {
            width: 100%;
        }
        .style2
        {
        }
        .style3
        {
            width: 491px;
        }
        .style4
        {
            width: 315px;
        }
        .style5
        {
            width: 233px;
        }
        .style6
        {
            height: 76px;
        }
    </style>
</head>
<body>
    
    <form id="form1" runat="server">
    <uc1:BookYourParty ID="BookYourParty1" runat="server" />
    </form>
    
    </body>
</html>

The error itself says that
u cannot use more than one form tags with runat="server" in a single page

So remove runat="server" from one of the form tag

0

Hi, thank you for your response, this may be a silly questions, but what page should I remove the tag from?

0

Hi, I'm a newbie working with ASP.Net, attempting to create a feedback form in ASP.Net VB but I am getting the below error message. Not really sure how to create this query that its asking for. Please help......

Page.IsValid cannot be called before validation has taken place. It should be queried in the event handler for a control that has CausesValidation=True and initiated the postback, or after a call to Page.Validate.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: Page.IsValid cannot be called before validation has taken place. It should be queried in the event handler for a control that has CausesValidation=True and initiated the postback, or after a call to Page.Validate.

User control code:

<%@ Control Language="VB" AutoEventWireup="false" CodeFile="BookYourParty.ascx.vb" Inherits="BookYourParty" %>
<style type="text/css">

        .style1
        {
            width: 100%;
        }
        .style6
    {
        height: 76px;
    }
        .style3
        {
            width: 491px;
        }
        .style4
        {
            width: 315px;
        }
    .style5
    {
    }
</style>

    <div>

        <table class="style1">
            <tr>
                <td colspan="2" style="font-weight: 700">
                    Book Your Party!</td>
            </tr>
            <tr>
                <td class="style6" colspan="2">
                    <asp:Menu ID="Menu1" runat="server" BackColor="#F7F6F3" 
                        DynamicHorizontalOffset="2" Font-Names="Verdana" Font-Size="0.8em" 
                        ForeColor="#7C6F57" Height="21px" Orientation="Horizontal" 
                        StaticEnableDefaultPopOutImage="False" StaticSubMenuIndent="10px" 
                        style="text-align: center" Width="364px">
                        <StaticSelectedStyle BackColor="#5D7B9D" />
                        <StaticMenuItemStyle HorizontalPadding="5px" ItemSpacing="10px" 
                            VerticalPadding="2px" />
                        <DynamicHoverStyle BackColor="#7C6F57" ForeColor="White" />
                        <DynamicMenuStyle BackColor="#F7F6F3" />
                        <DynamicSelectedStyle BackColor="#5D7B9D" />
                        <DynamicMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
                        <StaticHoverStyle BackColor="#7C6F57" ForeColor="White" />
                        <Items>
                            <asp:MenuItem NavigateUrl="~/AboutUs.aspx" Text="About Us" Value="About Us">
                            </asp:MenuItem>
                            <asp:MenuItem NavigateUrl="~/Services.aspx" Text="Services" Value="Services">
                                <asp:MenuItem NavigateUrl="~/ConciergeServices.aspx" Text="Conceirge Services" 
                                    Value="Conceirge Services"></asp:MenuItem>
                            </asp:MenuItem>
                            <asp:MenuItem NavigateUrl="~/Calendar.aspx" Text="Calendar" Value="Calendar">
                            </asp:MenuItem>
                            <asp:MenuItem NavigateUrl="~/ContactUs.aspx" Text="Contact Us" 
                                Value="Contact Us">
                                <asp:MenuItem NavigateUrl="~/BookYourParty.aspx" Text="Book Your Party" 
                                    Value="Book Your Party"></asp:MenuItem>
                                <asp:MenuItem NavigateUrl="~/CustomerFeedback.aspx" Text="Customer Feedback" 
                                    Value="Customer Feedback"></asp:MenuItem>
                                <asp:MenuItem NavigateUrl="~/EmploymentContractoropp.aspx" 
                                    Text="Employment - Contractor Opportunities" 
                                    Value="Employment - Contractor Opportunities"></asp:MenuItem>
                                <asp:MenuItem NavigateUrl="~/GeneralInquiry.aspx" Text="General Inquiry" 
                                    Value="General Inquiry"></asp:MenuItem>
                            </asp:MenuItem>
                            <asp:MenuItem NavigateUrl="~/PhotoGallery.aspx" Text="Photo Gallery" 
                                Value="Photo Gallery"></asp:MenuItem>
                            <asp:MenuItem NavigateUrl="~/Testimony.aspx" Text="Testimony" Value="Testimony">
                            </asp:MenuItem>
                            <asp:MenuItem NavigateUrl="~/Videos.aspx" Text="Videos" Value="Videos">
                            </asp:MenuItem>
                            <asp:MenuItem NavigateUrl="~/ClientLogin.aspx" Text="Client Login" 
                                Value="Client Login"></asp:MenuItem>
                            <asp:MenuItem NavigateUrl="~/FAQs.aspx" Text="FAQs" Value="FAQs"></asp:MenuItem>
                        </Items>
                    </asp:Menu>
                </td>
            </tr>
            <tr>
                <td class="style6" colspan="2">
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style6" colspan="2">
                    Please complete this form and we will get in touch with you within 24 hours.</td>
            </tr>
            <tr>
                <td class="style3">
                    <asp:Label ID="Label1" runat="server" Text="contact name"></asp:Label>
                    <asp:TextBox ID="TextBox1" runat="server" AutoCompleteType="FirstName" 
                        MaxLength="15"></asp:TextBox>
                    <asp:TextBox ID="TextBox2" runat="server" AutoCompleteType="LastName"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                        ControlToValidate="TextBox1" ErrorMessage="Please enter your first name">*</asp:RequiredFieldValidator>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" 
                        ControlToValidate="TextBox2" ErrorMessage="Please enter your last name">*</asp:RequiredFieldValidator>
                </td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style1">
                    <asp:Label ID="Label2" runat="server" Text="telephone"></asp:Label>
                    <asp:TextBox ID="TextBox3" runat="server" CausesValidation="True"></asp:TextBox>
                    <asp:Label ID="Label3" runat="server" Text="best time to call:"></asp:Label>
                    <asp:DropDownList ID="DropDownList1" runat="server">
                        <asp:ListItem>morning</asp:ListItem>
                        <asp:ListItem>noon</asp:ListItem>
                        <asp:ListItem>afternoon</asp:ListItem>
                        <asp:ListItem>evening</asp:ListItem>
                    </asp:DropDownList>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                        ControlToValidate="TextBox3" ErrorMessage="Please enter your phone number">*</asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
                        ControlToValidate="TextBox3" ErrorMessage="Please enter your telephone number" 
                        ValidationExpression="((\(\d{3}\) ?)|(\d{3}-))?\d{3}-\d{4}">*</asp:RegularExpressionValidator>
                    <asp:CustomValidator ID="CustomValidator1" runat="server" 
                        ClientValidationFunction="ValidatePhoneNumbers" Display="Dynamic" 
                        ErrorMessage="Please enter your telephone number">*</asp:CustomValidator>
                </td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style1">
                    <asp:Label ID="Label4" runat="server" Text="email address"></asp:Label>
                    <asp:TextBox ID="TextBox4" runat="server" Width="313px"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" 
                        ControlToValidate="TextBox4" ErrorMessage="Please enter your email address">*</asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" 
                        ControlToValidate="TextBox4" ErrorMessage="Please enter valid email address" 
                        ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">*</asp:RegularExpressionValidator>
                    <asp:CustomValidator ID="CustomValidator2" runat="server" 
                        ErrorMessage="Please enter your email address" 
                        ControlToValidate="TextBox4" Display="Dynamic">*</asp:CustomValidator>
                </td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style1">
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
        </table>

    </div>
    <div>
    <script type="text/javascript">
    function ValidatePhoneNumbers(source, args)
    {
    var textbox3=document.getElementById('<%= textbox3.ClientID %>');
    {
    args.IsValid = true;
    }
    }
    </script>
        <table class="style1">
            <tr>
                <td class="style3">
                    About your event:</td>
                <td>
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style3">
                    <asp:Label ID="Label5" runat="server" Text="number of guests:"></asp:Label>
                    <asp:DropDownList ID="DropDownList3" runat="server">
                        <asp:ListItem>less than 25</asp:ListItem>
                        <asp:ListItem>25 to 50</asp:ListItem>
                        <asp:ListItem>50 to 100</asp:ListItem>
                        <asp:ListItem>100 to 150</asp:ListItem>
                        <asp:ListItem>150 to 200</asp:ListItem>
                        <asp:ListItem>more than 200</asp:ListItem>
                    </asp:DropDownList>
                </td>
                <td>
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style3">
                    <asp:Label ID="Label6" runat="server" Text="event type:"></asp:Label>
                    <asp:DropDownList ID="DropDownList4" runat="server">
                        <asp:ListItem>holiday party</asp:ListItem>
                        <asp:ListItem>birthday party</asp:ListItem>
                        <asp:ListItem>private house party</asp:ListItem>
                        <asp:ListItem>wedding</asp:ListItem>
                        <asp:ListItem>corporate </asp:ListItem>
                        <asp:ListItem>bachelor/ette party</asp:ListItem>
                        <asp:ListItem>other</asp:ListItem>
                    </asp:DropDownList>
                </td>
                <td>
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style3">
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style3">
                    <asp:Label ID="Label8" runat="server" Text="event date and time:"></asp:Label>
                    <asp:DropDownList ID="DropDownList5" runat="server">
                        <asp:ListItem>mm/dd/yyyy</asp:ListItem>
                    </asp:DropDownList>
                </td>
                <td>
                    <asp:Label ID="Label9" runat="server" Text="length:"></asp:Label>
                    <asp:DropDownList ID="DropDownList2" runat="server" Height="19px" Width="160px">
                        <asp:ListItem>4 hours (minimum)</asp:ListItem>
                        <asp:ListItem>5 hours</asp:ListItem>
                        <asp:ListItem>6 hours</asp:ListItem>
                        <asp:ListItem>7 hours</asp:ListItem>
                        <asp:ListItem>8 hours</asp:ListItem>
                        <asp:ListItem>more than 8 hours</asp:ListItem>
                    </asp:DropDownList>
                </td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style3">
                    <asp:Label ID="Label10" runat="server" Text="venue contact info:"></asp:Label>
                    <asp:TextBox ID="TextBox10" runat="server" Width="331px" MaxLength="15"></asp:TextBox>
                </td>
                <td>
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
        </table>
    </div>
    <div>

        <table class="style1">
            <tr>
                <td class="style4">
                    Special requirements:</td>
                <td>
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style4">
                    <asp:CheckBox ID="CheckBox1" runat="server" Text="glassware rental" />
                </td>
                <td>
                    <asp:CheckBox ID="CheckBox3" runat="server" Text="decorations" />
                </td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style4">
                    <asp:CheckBox ID="CheckBox2" runat="server" Text="portable bar rental" />
                </td>
                <td>
                    <asp:CheckBox ID="CheckBox4" runat="server" Text="other:" />
                    <asp:TextBox ID="TextBox11" runat="server" Width="427px"></asp:TextBox>
                </td>
                <td>
                    &nbsp;</td>
            </tr>
        </table>

    </div>
    <div>

        <table class="style1" runat="server" id="FormTable">
            <tr>
                <td class="style5">
                    Additional Information / Comments:</td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style5">
                    &nbsp;</td>
                <td>
                    <asp:TextBox ID="TextBox12" runat="server" Height="169px" MaxLength="30" 
                        Width="410px"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" 
                        ControlToValidate="TextBox12" ErrorMessage="Please enter a comment">*</asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td class="style5">
                    &nbsp;</td>
                <td>
                    <input type="reset" value="clear form" />
                    <input type="submit" value="request info/quote" />

                </td>
            </tr>
            <tr>
                <td class="style5" colspan="2">
                    <asp:ValidationSummary ID="ValidationSummary1" runat="server" />
                </td>
            </tr>
        </table>
        <asp:Label ID="lblMessage" runat="server" Text="Message Sent" Visible="false"></asp:Label>

    </div>

    User control code behind:

Imports System.Net.Mail
Partial Class BookYourParty
    Inherits System.Web.UI.UserControl

    Protected Sub CustomValidator1_ServerValidate(ByVal source As Object, ByVal args As System.Web.UI.WebControls.ServerValidateEventArgs) Handles CustomValidator1.ServerValidate
        If TextBox3.Text IsNot String.Empty Then args.IsValid = True 
        args.IsValid = False
    End Sub
    Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox3.TextChanged, TextBox1.TextChanged, TextBox2.TextChanged, DropDownList3.TextChanged, DropDownList4.TextChanged, DropDownList5.TextChanged, DropDownList1.TextChanged, DropDownList1.SelectedIndexChanged, DropDownList3.SelectedIndexChanged, DropDownList4.SelectedIndexChanged, DropDownList2.SelectedIndexChanged, DropDownList2.TextChanged, TextBox10.TextChanged, TextBox11.TextChanged, CheckBox2.CheckedChanged, CheckBox1.CheckedChanged, CheckBox3.CheckedChanged, DropDownList5.SelectedIndexChanged
        If Page.IsValid Then
            Dim filename As String = Server.MapPath("~/App_Data/BookYourParty.txt")
            Dim mailbody As String = System.IO.File.ReadAllText(filename)

            mailbody = mailbody.Replace("##FirstName##", TextBox1.Text)
            mailbody = mailbody.Replace("##LastName##", TextBox2.Text)
            mailbody = mailbody.Replace("##HomePhone##", TextBox3.Text)
            mailbody = mailbody.Replace("##Email##", TextBox4.Text)
            mailbody = mailbody.Replace("##BestTimeToCall##", DropDownList1.SelectedValue)
            mailbody = mailbody.Replace("##NumberOfGuests##", DropDownList3.SelectedValue)
            mailbody = mailbody.Replace("##EventType##", DropDownList4.Text)
            mailbody = mailbody.Replace("##EventDateandTime##", DropDownList5.SelectedValue)
            mailbody = mailbody.Replace("##Length##", DropDownList2.SelectedValue)
            mailbody = mailbody.Replace("##VenueContactInfo##", TextBox10.Text)
            mailbody = mailbody.Replace("##GlasswareRental##", CheckBox1.Checked)
            mailbody = mailbody.Replace("##PortableBarRental##", CheckBox2.Checked)
            mailbody = mailbody.Replace("##Decorations##", CheckBox3.Checked)
            mailbody = mailbody.Replace("##Other##", CheckBox4.Checked)
            mailbody = mailbody.Replace("##AdditionalInformationComments##", TextBox12.Text)

            Dim myMessage As MailMessage = New MailMessage()
            myMessage.Subject = "Response from web site"
            myMessage.Body = mailbody

            myMessage.From = New MailAddress("contact@b-royaldesigns.com", "Sender Name Here")
            myMessage.To.Add(New MailAddress("contact@b-royaldesigns.com", "Receiver Name Here"))

            Dim mySmtpClient As SmtpClient = New SmtpClient()
            mySmtpClient.Send(myMessage)

            lblMessage.Visible = True
            FormTable.Visible = False
        End If
    End Sub
End Class

Edited by Reverend Jim: Fixed formatting

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.