Problem with converted ascx contact form user control (IsValid probably causing).
I have successfully (well almost) converted my aspx and aspx.cs contact form to a ascx contact form with .dll file. However, I seem to be having an issue with the form actually submiitting. It does validate the fields and the reset button works, however, the email form does not send. I think it has to do with the IsValid property.
Please take a look at code below.
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="contact.ascx.cs" Inherits="APTContact.contact" %>
<asp:ListItem>Please Select One</asp:ListItem> <asp:ListItem>I have had no cosmetic injection training </asp:ListItem> <asp:ListItem>I have been injecting Botox for less than 6 months </asp:ListItem> <asp:ListItem>I have been injecting Botox for more than 6 months </asp:ListItem> <asp:ListItem>I have been injecting Filler for less than 6 months </asp:ListItem> <asp:ListItem>I have been injecting Filler for more than 6 months </asp:ListItem> <asp:ListItem>I have been injecting Botox and Filler for less than 6 months </asp:ListItem> <asp:ListItem>I have been injecting Botox and Filler for more than 6 months </asp:ListItem> </asp:DropDownList> </td> </tr>
<tr> <td class="name" >I Heard About APT Training Through: </td> <td style="width: 250px"> <asp:DropDownList CssClass="field" runat="server" ID="HeardList" >
<tr> <td class="name" style="width: 155px">Comments:</td> <td style="width: 255px"> <asp:TextBox CssClass="field" ID="CommentsTB" runat="server" TextMode="MultiLine" Width="200px" Height="80px" /> </td> </tr> <tr> <td colspan="2" style="padding-left:220px; padding-top:20px"> <asp:Button CssClass="submit2" ID="btnSubmit" runat="server" Text="Submit" Width="70px" OnClick="SendMail" OnClientClick="_gaq.push(['_trackEvent', 'Website Homepage','Contact Form', 'Submit']);"/> <asp:Button CssClass="reset" ID="btnReset" runat="server" Text="Reset" Width="63px" OnClick="Reset" OnClientClick=" _gaq.push(['_trackEvent', 'Website Homepage','Contact Form', 'Reset']);"/> </td> </tr> </table> </form> </asp:PlaceHolder> <asp:PlaceHolder ID="successPH" runat="server" Visible="false"> <p class="thankyou" style="color:green">Thank you for your contacting APT Training & Consulting. We have recieved your message and will get back to you shortly.</p> </asp:PlaceHolder> <asp:PlaceHolder ID="failPH" runat="server" Visible="false"> <p style="color:red">Sorry, there was an error. Please try again. If it happens again, please send us an email.</p>
</asp:PlaceHolder>
</div>
and
using System; using System.Configuration; using System.Data; using System.Web; using System.Web.Security; using System.Collections.Generic; using System.Linq; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Net.Mail;
namespace APTContact { public partial class contact : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) {
I am still learning C# and umbraco etc. I thought it was necessary for the confirmation or error codes to appear. It was originally an aspx and aspx.cs form.
I don't want the Choose properties field to be checked but I cannot seem to change it. What can I change in my ascx.cs file (or where ever) to avoid this? The form works hard-coded, I don't know what to change.
Problem with converted ascx contact form user control (IsValid probably causing).
I have successfully (well almost) converted my aspx and aspx.cs contact form to a ascx contact form with .dll file. However, I seem to be having an issue with the form actually submiitting. It does validate the fields and the reset button works, however, the email form does not send. I think it has to do with the IsValid property.
Please take a look at code below.
and
and in the macro I get:
Thanks,
Chris.
if you have it like that,
your isvalid will be false.
Add the property to the macro and set its value or remove it.
What's the use of it?
I am still learning C# and umbraco etc. I thought it was necessary for the confirmation or error codes to appear. It was originally an aspx and aspx.cs form.
I don't want the Choose properties field to be checked but I cannot seem to change it. What can I change in my ascx.cs file (or where ever) to avoid this? The form works hard-coded, I don't know what to change.
Thanks, kows for the reply.
Chris.
if you drop public bool IsValid { get; set; }
the property wont show up anymore.
drop the following to make the form work:
if (!IsValid)
{
return;
}
else
{
(in between stays)
}
Thanks, Kows:
I ended up creating a new form , but it was the !IsValid property.
Thanks,
Chris.
is working on a reply...