</asp:PlaceHolder> <asp:PlaceHolder ID="successPH" runat="server" Visible="false"> <p class="thankyou" style="color:green">Thank you for your contacting us. 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>
using System; using System.Configuration; using System.Data; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Net.Mail;
public partial class contactus : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) {
What exactly is the problem? Is the control showing up? Are you getting an error message, and before or after you click Submit?
One common issue, if everything shows up but nothing happens when you click submit, make sure the macro is wrapped in a <form runat="server"> tag in your template.
Let us know the issue and I'm sure we can help get it straightened out!
Just off the top of my head, the Inherits attribute in the directive is ".usercontrol.contactus" but the class in the codebehind is "contactus". Have you changed these? Maybe try dropping the ".usercontrol." from the Inherits? Have you also copied the .dll file to /bin?
If not I'll take a look when I'm around VS tomorrow :)
Thanks for looking at this for me. I never created a dll for the form. I did change ".usercontrol.contactus" to "contactform.usercontrols.contactus". Does this help?
saying: Error Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (e.g. Page or UserControl).
If you changed to contactform.usercontrols.contactus, I believe you should change in your codebehind to match also, to public partial class contactform.usercontrols.contactus
So it looks like I have it up and working. Everything looks great (the reset button works, the balidation works) but it won't actually send the email or post back either a success or an error.....
Thanks for looking at that. I thought that was the problem as well. It is not a problem when hard-coding, however, when creating the macro, Umbraco selects it as a Property as Boolean.
Don't know much about it or why it is causing it.....
I have tried in umbraco also by setting IsValid's value=1 and it's showing error message to me. Error is due to smtp host. Is the IsValid's value 1 in your code? like "<umbraco:Macro IsValid="1" Alias="ContactForm1" runat="server"></umbraco:Macro>"
ascx and ascx.cs control
After trying for hours, I cannot get this to work.
I am trying to create a contact form that I had in a hard coded site to umbraco user control. Using 4.5.x. In VS, I have target framework of 3.5.
Here is my code:
Hi Chris,
What exactly is the problem? Is the control showing up? Are you getting an error message, and before or after you click Submit?
One common issue, if everything shows up but nothing happens when you click submit, make sure the macro is wrapped in a <form runat="server"> tag in your template.
Let us know the issue and I'm sure we can help get it straightened out!
-Tom
I put my ascx page in the usercontrols folder and the ascx.cs file in the app_code.
I get this error when Iclick "Browse Properties". On the site, I get:
Program Signup or Request More Information is seperate <h1> tag.
Just off the top of my head, the Inherits attribute in the directive is ".usercontrol.contactus" but the class in the codebehind is "contactus". Have you changed these? Maybe try dropping the ".usercontrol." from the Inherits? Have you also copied the .dll file to /bin?
If not I'll take a look when I'm around VS tomorrow :)
-Tom
Hey, Tom:
Thanks for looking at this for me. I never created a dll for the form. I did change ".usercontrol.contactus" to "contactform.usercontrols.contactus". Does this help?
Again, appreciate it!
Chris.
I also get this is VS:
saying: Error Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (e.g. Page or UserControl).
(still trying to learn).
If you changed to contactform.usercontrols.contactus, I believe you should change in your codebehind to match also, to public partial class contactform.usercontrols.contactus
Doesn't seem to be doing it tom..... hmmm
So it looks like I have it up and working. Everything looks great (the reset button works, the balidation works) but it won't actually send the email or post back either a success or an error.....
I checked your code. Validation and reset button works but while sending mail it won't send. Again I tried by removing
if (!IsValid) { return; }
Now I got error. So may be Isvalid is creating problem in your code.
Pnima
Hi, Pnima:
Thanks for looking at that. I thought that was the problem as well. It is not a problem when hard-coding, however, when creating the macro, Umbraco selects it as a Property as Boolean.
Don't know much about it or why it is causing it.....
Hi Chris
I have tried in umbraco also by setting IsValid's value=1 and it's showing error message to me. Error is due to smtp host. Is the IsValid's value 1 in your code? like "<umbraco:Macro IsValid="1" Alias="ContactForm1" runat="server"></umbraco:Macro>"
Hi, Pasang:
I tried that it and it doesnt seemt to have an effect.
Chris.
is working on a reply...