Etienne
Etienne

Reputation: 7201

Custom form in Umbraco limitations?

I am busy learning about Umbraco but I don't see anything on the internet that tells me if Umbraco will allow me to create a custom ASP.NET form using C# code connecting to a SQL Server Database.

Would I have any issues with Umbraco if I need to create such a custom form in ASP.NET and bring it into Umbraco?

Upvotes: 3

Views: 3091

Answers (3)

Goran Mottram
Goran Mottram

Reputation: 6304

There are two ways (that I know of, at least) where you can implement custom .Net forms in Umbraco (Version 4.7.x and below).

Template-Based

You can build the form directly in the template markup using standard ASP.Net controls and using a <script runat="server" language="c#"> tag. This is standing inline page coding as you would in Visual Studio, so you give up the luxuries of pre-compilation etc.

<%@ Master Language="C#" MasterPageFile="~/umbraco/masterpages/default.master" AutoEventWireup="true" %>
<asp:Content ContentPlaceHolderID="ContentPlaceHolderDefault" runat="server">
    <asp:Label ID="myLabel" runat="server" />
</asp:Content>
<script runat="server" language="c#">
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            this.myLabel.Text = "Hello World";
        }    
    }  
</script>

Macro-Based

  1. Build your forms in User Controls in Visual Studio and compile it.
  2. Copy the .ascx to the /usercontrols/ folder.
  3. Copy the .dll to the /bin/ folder.
  4. Navigate to Developer > Macros in Umbraco and create a new Macro
  5. Select your user control from the drop down next to .Net User Control on the Macro Properties tab.
  6. Import you macro into your template. Done!
  7. (Optional) If you user control requires properties to be set, don't forget to add them to properties tab in your macro and map them.

Your template code will look something like the following:

<%@ Master Language="C#" MasterPageFile="~/umbraco/masterpages/default.master" AutoEventWireup="true" %>
<asp:Content ContentPlaceHolderID="ContentPlaceHolderDefault" runat="server">
    <umbraco:Macro Alias="MyForm" MyProperty="Hi!" runat="server" />
</asp:Content>

Upvotes: 3

BeaverProj
BeaverProj

Reputation: 2215

Another fast and cheap option is using the Contour Forms package. It costs about 99 euros and provides a WYSIWYG interface to creating forms. It has workflow and the ability to store the values in custom tables.

We really like it and it works for probably 75% - 80% of cases where you need a form.

http://umbraco.com/products/more-add-ons/contour.aspx

Upvotes: 1

E.J. Brennan
E.J. Brennan

Reputation: 46879

You can definitely do this in version 4.7 (and earlier versions), by creating a asp.net custom control, and then adding it into the system - its all pretty easy to do.

In V5 you can't create custom controls since it is now MVC based, and as I am just getting upto speed on v5, can't comment on how hard/different it is yet.

Which version are you using?

Upvotes: 0

Related Questions