Custom Control - Design Time Support

Discussion in 'ASP .Net' started by Guest, Jan 24, 2007.

  1. Guest

    Guest Guest

    I am creating a custom control which is a form generator. Basically you
    define some parameters, and it will build input control (textbox), tooltip,
    validation code etc in one swoop.

    Something such as:
    1 <tt:DataForm ID="DataForm1" runat="server">
    2 <Columns>
    3 <tt:DataColumn ID="FirstName" runat="server"
    AllowDottedDecimal="False" AllowDottedHex="False"
    4 AllowDottedOctal="False" AllowHybrid="False"
    AllowIPv6="False" AllowTerritories="False"
    5 Exponent="False" Format="" Fractional="False"
    InvalidMessage="" Label="First Name" Lowercase="False"
    6 MissingMessage="" RegExp="" Required="True" Scheme="False"
    Signed="False" Trim="False"
    7 UCFirst="False" Uppercase="False"
    ValidationType="ValidationTextbox" Value="">
    8 </tt:DataColumn>
    9 <tt:DataColumn ID="LastName" runat="server"
    AllowDottedDecimal="False" AllowDottedHex="False"
    10 AllowDottedOctal="False" AllowHybrid="False"
    AllowIPv6="False" AllowTerritories="False"
    11 Exponent="False" Format="" Fractional="False"
    InvalidMessage="" Label="Last Name" Lowercase="False"
    12 MissingMessage="" RegExp="" Required="True" Scheme="False"
    Signed="False" Trim="False"
    13 UCFirst="False" Uppercase="False"
    ValidationType="ValidationTextbox" Value="">
    14 </tt:DataColumn>
    15 </Columns>
    16 </tt:DataForm>

    So lets pretend your form has 30 columns. It will create 30 textbox's based
    on the parameters you set etc.

    I am new to ASP.NET so please bare with me. I have all this working
    currently. My main issue is, if a developer is using my form generator, how
    do they access those inputs in the postback?

    Sure they can do dataForm.FindControl("something"); 30 times and then if
    textbox, if combobox, build SQL for insert/update etc. But this seems very
    ugly to me.

    How can I make the TextBox's that my control generates based on the
    parameters visible to the designer so someone can do something such as:
    Text1.Text in the postback codebehind?

    I am positive designer interface of some sort can help here but I am not
    very experienced. I have only done some basic designer stuff like
    CollectionEditor's etc.

    Any help would be greatly appreciated.

    Thanks and take care.
     
    Guest, Jan 24, 2007
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.