Home All Groups Group Topic Archive Search About

Dynamic Row Template in GridView

Author
27 Jun 2006 5:40 PM
Erik
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

Author
27 Jun 2006 8:44 PM
Phillip Williams
http://www.webswapp.com/codesamples/aspnet20/itemplate/gridview.aspx
Show quote Hide quote
"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
Are all your drivers up to date? click for free checkup

Author
28 Jun 2006 12:51 PM
Erik
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

Show quoteHide quote
"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
Author
12 Jul 2006 5:28 PM
Daniel
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!!!.
Show quoteHide quote
:)

Bookmark and Share