generate textboxes dynamically

Discussion in 'ASP .Net' started by =?Utf-8?B?TWlrZQ==?=, Sep 17, 2007.

  1. Hi,

    I've a textbox called MyTextBox in my form and I would like to generate 10
    other textboxes dynamically as an instance of Mytexbox that have the same
    events and properties.
    how can I do it
    --
    Regards,
    M.Rochdi
    =?Utf-8?B?TWlrZQ==?=, Sep 17, 2007
    #1
    1. Advertising

  2. =?Utf-8?B?TWlrZQ==?=

    Just Me Guest

    Erm, well lets first get something straight. Your 'MyTextBox' is an
    Instance of TextBox. You cannot derive from an instance of a class only
    from the class itself.

    In order to acheive what you are looking for you would have to create a
    class which inherits from TextBox and set the properties as you want them
    during constrcution. And then instantiate from that.

    As far as events are concerned, if you want all the text boxes to "Share"
    the same event handlers, this can be added programatically using the
    AddEvent Handler.

    Perhaps it would server a better purpose to explain exactly what you are
    trying to acheive and why. This will ellicit a more intelligent response.



    "Mike" <> wrote in message
    news:...
    > Hi,
    >
    > I've a textbox called MyTextBox in my form and I would like to generate 10
    > other textboxes dynamically as an instance of Mytexbox that have the same
    > events and properties.
    > how can I do it
    > --
    > Regards,
    > M.Rochdi
    Just Me, Sep 19, 2007
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Forconi Boris via .NET 247

    TextBoxes created dynamically : How to store data?

    Forconi Boris via .NET 247, Jun 17, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    380
    Trevor Benedict R
    Jun 18, 2004
  2. Tony
    Replies:
    5
    Views:
    373
    Jeff Louie
    Jun 27, 2004
  3. Charith Jayasundara via .NET 247

    How to use custom validators for dynamically genrated textboxes

    Charith Jayasundara via .NET 247, Mar 23, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    419
    Brock Allen
    Mar 23, 2005
  4. SD
    Replies:
    3
    Views:
    453
    =?Utf-8?B?S2V6emE=?=
    Jun 23, 2005
  5. Sirisha
    Replies:
    1
    Views:
    162
Loading...

Share This Page