dynamically work with datagrids

Discussion in 'ASP .Net Building Controls' started by et, Dec 17, 2004.

  1. et

    et Guest

    How can I dynamically get the type of control in a datagrid. I have several
    columns that when editing a row, one column may be a dropdownlist, the next
    column may be a text box, the next column may be a label, or something else,
    depending on what the datagrid is for and whether the user has access to
    that column. So when retrieving the values of the datagrid row in order to
    update the database, I need to be able to retrieve the type of control that
    is in each column.

    Question 2: How do I set the type of control dynamically in the first
    place. In some circumstances, I want to be able to allow the user edit of
    the row, but as above depending on their rights, one column may be a drop
    down or it may be a text box or it may be an uneditable label.

    TIA
    et, Dec 17, 2004
    #1
    1. Advertising

  2. About Question 2,
    to do that you need use the Edit Item Template to put the objects that you
    want use in Edit Mode and all visible=false, and in the EditItemCommand you
    take the decision the object to make visible DropDown, TextBox or Label
    depending of rigths to do.

    I hope that helps you,

    Elmer Carías
    El Salvador, CA



    "et" <> wrote in message
    news:...
    > How can I dynamically get the type of control in a datagrid. I have

    several
    > columns that when editing a row, one column may be a dropdownlist, the

    next
    > column may be a text box, the next column may be a label, or something

    else,
    > depending on what the datagrid is for and whether the user has access to
    > that column. So when retrieving the values of the datagrid row in order

    to
    > update the database, I need to be able to retrieve the type of control

    that
    > is in each column.
    >
    > Question 2: How do I set the type of control dynamically in the first
    > place. In some circumstances, I want to be able to allow the user edit of
    > the row, but as above depending on their rights, one column may be a drop
    > down or it may be a text box or it may be an uneditable label.
    >
    > TIA
    >
    >
    Elmer Carías, Dec 17, 2004
    #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. Shane O'Keeffe

    Dynamically positioning DataGrids

    Shane O'Keeffe, Aug 3, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    530
    Shane O'Keeffe
    Aug 4, 2004
  2. Jim Bancroft
    Replies:
    3
    Views:
    379
    Jim Bancroft
    Dec 20, 2004
  3. ree32
    Replies:
    4
    Views:
    806
    ree32
    Feb 21, 2005
  4. ree32
    Replies:
    1
    Views:
    361
    =?Utf-8?B?SmltIEhlYXZleQ==?=
    Feb 18, 2005
  5. Anna
    Replies:
    1
    Views:
    370
Loading...

Share This Page