Dynamic Controls Problem

Discussion in 'ASP .Net' started by Elliot Rodriguez, Mar 2, 2006.

  1. I have a dropdown list that defines the number of textboxes that appear
    within a particular panel. The boxes are created when the dropdownlist's
    SelectedIndexChanged event fires on postback.

    Also in the form is a datagrid that has some custom validation performed on
    values within its rows. The validation is server side but not tied into any
    ValidatorControls.

    When the form is submitted, if the datagrid contains values that are invalid
    according to my rules, the page reloads but my textboxes created in the
    previous panel are gone. The dropdownbox still holds its value but the
    requisite number of textboxes is no longer there.

    I know this is probably a problem with the page events when the controls are
    rendered, the problem I cant figure out is how to keep the controls created
    during the dropdown's event; Init and Render have already fired.

    Any suggestions?

    Thanks
     
    Elliot Rodriguez, Mar 2, 2006
    #1
    1. Advertising

  2. Dynamic controls need to be recreated on every postback.

    ASP.NET does this for you for controls you declare on your page because it
    knows about them. You need to do it yourself for any dynamic controls added.

    "Elliot Rodriguez" <elliotrodriguezatgeemaildotcom> wrote in message
    news:...
    >I have a dropdown list that defines the number of textboxes that appear
    >within a particular panel. The boxes are created when the dropdownlist's
    >SelectedIndexChanged event fires on postback.
    >
    > Also in the form is a datagrid that has some custom validation performed
    > on values within its rows. The validation is server side but not tied into
    > any ValidatorControls.
    >
    > When the form is submitted, if the datagrid contains values that are
    > invalid according to my rules, the page reloads but my textboxes created
    > in the previous panel are gone. The dropdownbox still holds its value but
    > the requisite number of textboxes is no longer there.
    >
    > I know this is probably a problem with the page events when the controls
    > are rendered, the problem I cant figure out is how to keep the controls
    > created during the dropdown's event; Init and Render have already fired.
    >
    > Any suggestions?
    >
    > Thanks
    >
     
    Marina Levit [MVP], Mar 2, 2006
    #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. =?Utf-8?B?VGVyb3M=?=

    Dynamic Variables? OR Dynamic Controls

    =?Utf-8?B?VGVyb3M=?=, Aug 10, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    436
    Scott Allen
    Aug 10, 2004
  2. Replies:
    5
    Views:
    5,627
  3. Ronald
    Replies:
    2
    Views:
    873
    Robbe Morris [C# MVP]
    Jan 17, 2006
  4. =?Utf-8?B?U3RldmUgRnVuaw==?=

    Dynamic Wizard with Dynamic Validation Controls

    =?Utf-8?B?U3RldmUgRnVuaw==?=, Oct 13, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    472
    =?Utf-8?B?U3RldmUgRnVuaw==?=
    Oct 13, 2006
  5. Denny Smolinski via .NET 247

    Dynamic Controls, Placeholder, Retrieve Information from Dynamic Controls

    Denny Smolinski via .NET 247, May 4, 2004, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    504
    Eidolon
    May 4, 2004
Loading...

Share This Page