Dynamic Row Template in GridView

Discussion in 'ASP .Net Web Controls' started by Erik, Jun 27, 2006.

  1. Erik

    Erik Guest

    Good Afternoon,
    I am trying to figure out how to dynamically create a TemplateColumn based
    on a record's field value. If the record has a DataType of Number or Text, I
    would like a textbox to render. If the record's DataType is List, a
    DropDownList would be rendered. All the examples I have been studying deal
    with columns, where these controls need to be defined for each row.
    Any help is greatly appreciated.
    Thanks, Erik
    Erik, Jun 27, 2006
    #1
    1. Advertising

  2. http://www.webswapp.com/codesamples/aspnet20/itemplate/gridview.aspx
    --
    HTH,
    Phillip Williams
    http://www.societopia.net
    http://www.webswapp.com


    "Erik" wrote:

    > Good Afternoon,
    > I am trying to figure out how to dynamically create a TemplateColumn based
    > on a record's field value. If the record has a DataType of Number or Text, I
    > would like a textbox to render. If the record's DataType is List, a
    > DropDownList would be rendered. All the examples I have been studying deal
    > with columns, where these controls need to be defined for each row.
    > Any help is greatly appreciated.
    > Thanks, Erik
    Phillip Williams, Jun 27, 2006
    #2
    1. Advertising

  3. Erik

    Erik Guest

    Good Morning Phillip,
    Thanks for the response. The columns for this GridView are going to always
    be the same, one column for the question, one column for the response. Each
    row in the GridView has to be rendered differently based on the record's
    data. It looks like I can use the GridView_RowDataBound, but I am having
    difficuly how to dynamically add one column for the text of the question, and
    the second column for the control (either a textbox or dropdownlist) to
    capture the answer.
    Thanks,
    Erik

    "Phillip Williams" wrote:

    > http://www.webswapp.com/codesamples/aspnet20/itemplate/gridview.aspx
    > --
    > HTH,
    > Phillip Williams
    > http://www.societopia.net
    > http://www.webswapp.com
    >
    >
    > "Erik" wrote:
    >
    > > Good Afternoon,
    > > I am trying to figure out how to dynamically create a TemplateColumn based
    > > on a record's field value. If the record has a DataType of Number or Text, I
    > > would like a textbox to render. If the record's DataType is List, a
    > > DropDownList would be rendered. All the examples I have been studying deal
    > > with columns, where these controls need to be defined for each row.
    > > Any help is greatly appreciated.
    > > Thanks, Erik
    Erik, Jun 28, 2006
    #3
  4. Erik

    Daniel Guest

    Hi guys, I'm having the same exact situation, i need to put on some rows a dropdownlist or a textbox (depending on a particular situation), please please let me know if there a way to do this.
    thanks a lot!!!.
    :)
    Daniel, Jul 12, 2006
    #4
    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. Fernando Lopes
    Replies:
    0
    Views:
    3,190
    Fernando Lopes
    Apr 28, 2005
  2. misiek
    Replies:
    0
    Views:
    2,278
    misiek
    Feb 20, 2006
  3. H5N1
    Replies:
    0
    Views:
    2,712
  4. Replies:
    5
    Views:
    656
  5. D
    Replies:
    0
    Views:
    203
Loading...

Share This Page