Click here to Skip to main content
15,892,005 members
Articles / Web Development / ASP.NET

Web User Forms for ASP.NET

Rate me:
Please Sign up or sign in to vote.
4.90/5 (52 votes)
18 Sep 2012CPOL12 min read 135.5K   4.5K   187  
User driven runtime dynamic ASP.NET Web Forms
<%@ Register Assembly="Itenso.WebUserForms.Controls" Namespace="Itenso.WebUserForms.Controls"
  TagPrefix="cc1" %>
<%@ Control Language="C#" ClassName="AllFormFieldsControl" %>
<table width="100%">
  <tr>
    <td width="20%">
      <asp:Label ID="Label10" runat="server" Text="WebformHeader:"></asp:Label>
    </td>
    <td>
      <cc1:UserFormHeader ID="WebFormHeader1" runat="server" Description="Simple User Control"
        Type="Test" Name="SimpleUserControlForm" />
    </td>
  </tr>
  <tr>
    <td>
      <asp:Label ID="Label1" runat="server" Text="TextBox:"></asp:Label>
    </td>
    <td>
      <cc1:TextBox ID="TextBox1" runat="server" FieldName="FirstName"></cc1:TextBox>
    </td>
  </tr>
  <tr>
    <td>
      <asp:Label ID="Label2" runat="server" Text="ListBox:"></asp:Label>
    </td>
    <td>
      <cc1:ListBox ID="ListBox1" runat="server" FieldName="ListBoxFormField1" FieldValue="Item 1,Item 2"
        SelectionMode="Multiple">
        <asp:ListItem Selected="True" Value="Value1">Item 1</asp:ListItem>
        <asp:ListItem Selected="True" Value="Value2">Item 2</asp:ListItem>
        <asp:ListItem Value="Value3">Item 3</asp:ListItem>
      </cc1:ListBox>
    </td>
  </tr>
  <tr>
    <td>
      <asp:Label ID="Label3" runat="server" Text="DropDownList:"></asp:Label>
    </td>
    <td>
      <cc1:DropDownList ID="DropDownList1" runat="server" FieldName="DropDownFormField1">
        <asp:ListItem Selected="True" Value="Value1">Item 1</asp:ListItem>
        <asp:ListItem Value="Value2">Item 2</asp:ListItem>
        <asp:ListItem Value="Value3">Item 3</asp:ListItem>
      </cc1:DropDownList>
    </td>
  </tr>
  <tr>
    <td>
      <asp:Label ID="Label15" runat="server" Text="ComboBox:"></asp:Label>
    </td>
    <td>
      <cc1:ComboBox ID="ComboBox1" runat="server" FieldName="ComboBoxField1">
        <asp:ListItem Selected="True" Value="Value1">Item 1</asp:ListItem>
        <asp:ListItem Value="Value2">Item 2</asp:ListItem>
        <asp:ListItem Value="Value3">Item 3</asp:ListItem>
      </cc1:ComboBox>
    </td>
  </tr>
  <tr>
    <td>
      <asp:Label ID="Label11" runat="server" Text="LookupListBox:"></asp:Label>
    </td>
    <td>
      <cc1:LookupListBox ID="LookupListBox1" runat="server" FieldName="LookupListBoxFormField1"
        LookupName="ListBoxLookup">
      </cc1:LookupListBox>
    </td>
  </tr>
  <tr>
    <td>
      <asp:Label ID="Label12" runat="server" Text="LookupDropDownList:"></asp:Label>
    </td>
    <td>
      <cc1:LookupDropDownList ID="LookupDropDownList1" runat="server" FieldName="LookupDropDownFormField1"
        LookupName="DropDownListLookup">
      </cc1:LookupDropDownList>
    </td>
  </tr>
  <tr>
    <td>
      <asp:Label ID="Label16" runat="server" Text="LookupComboBox:"></asp:Label>
    </td>
    <td>
      <cc1:LookupComboBox ID="LookupComboBox1" runat="server" FieldName="LookupComboBoxFormField1"
        LookupName="ComboBoxLookup">
      </cc1:LookupComboBox>
    </td>
  </tr>
  <tr>
    <td>
      <asp:Label ID="Label4" runat="server" Text="CheckBox:"></asp:Label>
    </td>
    <td>
      <cc1:CheckBox ID="CheckBox1" runat="server" FieldName="CheckBoxFormField1" Text="Option" />
    </td>
  </tr>
  <tr>
    <td>
      <asp:Label ID="Label5" runat="server" Text="CheckBoxList:"></asp:Label>
    </td>
    <td>
      <cc1:CheckBoxList ID="CheckBoxList1" runat="server" FieldName="CheckBoxListFormField1"
        RepeatColumns="2">
        <asp:ListItem Value="Value1">Option 1</asp:ListItem>
        <asp:ListItem Value="Value2">Option 2</asp:ListItem>
        <asp:ListItem Value="Value3">Option 3</asp:ListItem>
        <asp:ListItem Value="Value4">Option 4</asp:ListItem>
      </cc1:CheckBoxList>
    </td>
  </tr>
  <tr>
    <td>
      <asp:Label ID="Label6" runat="server" Text="RadioButton:"></asp:Label>
    </td>
    <td>
      <cc1:RadioButton ID="RadioButton1" runat="server" FieldName="RadioButtonFormField1"
        Text="Option" />
    </td>
  </tr>
  <tr>
    <td>
      <asp:Label ID="Label7" runat="server" Text="RadioButtonList:"></asp:Label>
    </td>
    <td>
      <cc1:RadioButtonList ID="RadioButtonList1" runat="server" FieldName="RadioButtonListFormField1"
        RepeatDirection="Horizontal">
        <asp:ListItem Value="Value1">Option 1</asp:ListItem>
        <asp:ListItem Value="Value2">Option 2</asp:ListItem>
      </cc1:RadioButtonList>
    </td>
  </tr>
  <tr>
    <td>
      <asp:Label ID="Label13" runat="server" Text="TimePicker:"></asp:Label>
    </td>
    <td>
      <cc1:TimePicker ID="TimePicker1" runat="server" FieldName="TimePickerField1"></cc1:TimePicker>
    </td>
  </tr>
  <tr>
    <td>
      <asp:Label ID="Label14" runat="server" Text="DatePicker:"></asp:Label>
    </td>
    <td>
      <cc1:DatePicker ID="DatePicker1" runat="server" FieldName="DatePickerField1"></cc1:DatePicker>
    </td>
  </tr>
  <tr>
    <td>
      <asp:Label ID="Label8" runat="server" Text="Calendar:"></asp:Label>
    </td>
    <td>
      <cc1:Calendar ID="Calendar1" runat="server" FieldName="CalendarFormField1">
      </cc1:Calendar>
    </td>
  </tr>
  <tr>
    <td>
      <asp:Label ID="Label9" runat="server" Text="Visible Variable:"></asp:Label>
    </td>
    <td>
      <cc1:VisibleVariable ID="Variable1" runat="server" FieldName="VisibleVariableField1"
        FieldExpression="${System.CurrentDate}" FieldValue="${System.CurrentDate}">
                ${System.CurrentDate}</cc1:VisibleVariable>
    </td>
  </tr>
  <tr>
    <td>
      <asp:Label ID="Label17" runat="server" Text="Hidden Variable:"></asp:Label>
    </td>
    <td>
      <cc1:HiddenVariable ID="HiddenVariable1" runat="server" FieldName="HiddenVariableField1"
        FieldExpression="${System.CurrentDate}" FieldValue="${System.CurrentDate}" />
    </td>
  </tr>
</table>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
Switzerland Switzerland
👨 Senior .NET Software Engineer

🚀 My Open Source Projects
- Time Period Library 👉 GitHub
- Payroll Engine 👉 GitHub

Feedback and contributions are welcome.



Comments and Discussions