Adding Dynamic Controls to a DataGrid for use with the built in DataGrid Edit/Update functionality

Discussion in 'ASP .Net Datagrid Control' started by davidjgonzalez@gmail.com, Mar 24, 2006.

  1. Guest

    (VS 2003, .NET 1.1)
    I am trying to add dynamic controls to the cells of an Edit Row in a
    DataGrid and am having a terrible time.
    I cannot for the life of me get the values from the dynamic controls
    after the page posts back on the DataGrid UpdateRow event.

    When I create a dynamic control (these are almost always
    dropdownlists), for example a States dropdownlist, i give the new
    DropDownList object an ID: "DYNAMIC_CONTROL_States". I notice when i
    view source on the Edit DataGrid webpage the DropDownList's ID in the
    HTML is something like "DataGridName__ctl2_ct3_DYNAMIC_CONTROL_States".

    In this case do i have to re-generate the States dropdownlist OnInit
    with the ID "DYNAMIC_CONTROL_States" or
    "DataGridName__ctl2_ct3_DYNAMIC_CONTROL_States".

    Where do i regenrate them? in OnInit()? What does it take to regenerate
    them?

    DropDownList myStates = new DropDownList().
    myStates.ID = DYNAMIC_CONTROL_States;

    do i have to add the DropDownList items as well?
    is there anything else I have to do to bind the postback value that is
    floating around in the ViewState to this control?

    Can I see the value without re-generating the control? (ViewState[]
    doesnt have anything in it)

    If anyone has _ANY_ insight into adding dynamic controls to DataGrids i
    would very much like to hear it. as it stands this is killin me.

    Also - has anyone ever seen this working before or suceeded in getting
    dynamic controls IN A DATAGRID to postback values? I've read around 50
    different articles and have seen anyone say they've suceeded with a
    datagrid (they have managed to do it w/ standalone controls).

    Thanks
    , Mar 24, 2006
    #1
    1. Advertising

  2. Guest

    One last thing - my DataGrid has AutoGenerateColumns = true (so the
    DataGrid can display any DataSource)
    , Mar 25, 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. Kikoz
    Replies:
    6
    Views:
    385
    Indentix, Inc.
    Jul 27, 2004
  2. Schultz
    Replies:
    3
    Views:
    555
    =?Utf-8?B?QmlsbCBCb3Jn?=
    Feb 14, 2005
  3. Andreas Klemt
    Replies:
    0
    Views:
    293
    Andreas Klemt
    Oct 8, 2003
  4. Andy Johns

    Adding javascript function to update button in datagrid edit row

    Andy Johns, Nov 28, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    204
    Andy Johns
    Nov 28, 2003
  5. Kostia
    Replies:
    1
    Views:
    263
    Scott Mitchell [MVP]
    Feb 26, 2004
Loading...

Share This Page