I've developed my own contact form as an aspx page that I would like to use with Umbraco. What is the right approach to incorporate this page into my Umbraco website? I'd like to keep the same master page and styles as the rest of the website.
Is there anyway that you could convert the aspx page to a custom control (ascx)? If so, you could create a custom control, upload it to the /usercontrols directory, then create a macro. The macro would point to the ASCX control. You could then add that new Contact Page macro to any template you like. You could then make a new template that includes this macro and assign this template to your Contact Page node in the content tree.
Thanks Justin for your reply. Wow, it sounds like a bit of work especially when I do not have experience with Umbraco macros and templates. Let me put your guidelines into a step-by-step walkthrough:
1. Convert the Contact.aspx page into a user control Contact.ascx (no problem with that). 2. Upload the Contact.ascx user control to the /usercontrols folder. 3. Create an Umbraco macro and point it to the user control. 4a. Add the macro to any template. -or- 4b. Create a new template, add the macro to it, and assign the template to the Contact Page node in the content tree.
Could you confirm please if the above steps are correct?
However I forgot that you can add it using other methods as well. Using a macro gives you the ability to insert the macro on a content page using the content editor for your node. If you choose the option for "Enable in Editor" on your macro, you can insert the macro using a picklist on the WYSIWYG html editor on the content editor tab for your page. If you create a Contact Us Node anywhere, you should see the "Insert Macro" on the content toolbar for the body text. If you enabled the macro to be available in the UI, then you will have a Contact Us macro in the drop down list for macros to insert. This method prevents you from having to create a specific template for the Contact page. So your users can enter contact forms on ANY page.
If you don't need that ability and don't fell like making a macro, then you can short circuit the process a little bit. You don't really have to have the macro for the custom control since it is just a regular old custom control. If you wanted you could also do this.
Convert the Contact.aspx page into a user control Conatct.ascx
Upload the Contact.ascs user control to the /userscontrols folder (and your compiled .dll to the bin folder)
Update the template you will use for your Contact page and add the user control like any normal user control using the standard Register tags on the page like the following.
I've decided to create a macro and a template as it turned out it was not a big work - it works like a charm. A user control directly on the template worked well too.
Custom Contact Form
Hi,
I've developed my own contact form as an aspx page that I would like to use with Umbraco. What is the right approach to incorporate this page into my Umbraco website? I'd like to keep the same master page and styles as the rest of the website.
Thanks,
Leszek
Is there anyway that you could convert the aspx page to a custom control (ascx)? If so, you could create a custom control, upload it to the /usercontrols directory, then create a macro. The macro would point to the ASCX control. You could then add that new Contact Page macro to any template you like. You could then make a new template that includes this macro and assign this template to your Contact Page node in the content tree.
Thanks Justin for your reply. Wow, it sounds like a bit of work especially when I do not have experience with Umbraco macros and templates. Let me put your guidelines into a step-by-step walkthrough:
1. Convert the Contact.aspx page into a user control Contact.ascx (no problem with that).
2. Upload the Contact.ascx user control to the /usercontrols folder.
3. Create an Umbraco macro and point it to the user control.
4a. Add the macro to any template.
-or-
4b. Create a new template, add the macro to it, and assign the template to the Contact Page node in the content tree.
Could you confirm please if the above steps are correct?
Thanks,
Leszek
Yes you are correct. That will work.
However I forgot that you can add it using other methods as well. Using a macro gives you the ability to insert the macro on a content page using the content editor for your node. If you choose the option for "Enable in Editor" on your macro, you can insert the macro using a picklist on the WYSIWYG html editor on the content editor tab for your page. If you create a Contact Us Node anywhere, you should see the "Insert Macro" on the content toolbar for the body text. If you enabled the macro to be available in the UI, then you will have a Contact Us macro in the drop down list for macros to insert. This method prevents you from having to create a specific template for the Contact page. So your users can enter contact forms on ANY page.
If you don't need that ability and don't fell like making a macro, then you can short circuit the process a little bit. You don't really have to have the macro for the custom control since it is just a regular old custom control. If you wanted you could also do this.
I hope this helps, let me know if you need any more information.
On this project page is a demo user contact form. You can also use it for having all the contact form info in 1 datatype.
Jeroen
Thanks a lot!
I've decided to create a macro and a template as it turned out it was not a big work - it works like a charm. A user control directly on the template worked well too.
Thanks again,
Leszek
Leszek, I am glad that it worked for you. It is so easy to find several ways to do the same task in umbraco. I love how everything is so flexible.
Jeroen, that package looks really cool, I will have to try that out on my next site. Thanks!
Justin
is working on a reply...