Add an ASCX control to the page
After converting a form to an ascx file, you can add it to your page.
In the Web Forms for Marketers module, you can convert and export a form to an .ascx file and then add it to your website as an ASCX control. For developers, this can make it easier to develop their custom form control.
To add an ASCX control to the page:
Using a text editor, in the
\layouts
folder of your Sitecore installation, create a newdefault.aspx
page and insert the following code:<%@ Page Language="C#" AutoEventWireup="true" %> <!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>Untitled Page</title> </head> <body> <form id="form1" runat="server"> </form> </body> </html>
In the Form Designer, in the Export group, click To ASCX and export the relevant form data to the
\layouts
folder. Use theforms.ascx
format for the name of the file.In the
default.aspx
page that you created, add the following code after the first<%@ Page>
tag:<%@ Register Src="form.ascx" TagName="SimpleForm" TagPrefix="uc1" %>
Inside the
<form>
tag, insert the following code:<div> <uc1:SimpleForm ID="WebUserControl1" runat="server" /> </div> </form>
In your web browser, enter the following URL: http://localhost/layouts/default.aspx.
Note
After you make changes to the .ascx file, the module does not verify that the form works correctly