|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Dynamic Row Template in GridViewGood 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
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 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 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 :)
Other interesting topics
Adding WebControl using a Button....
TextBox TextChanged Event changing cursor of ImageButton Reference of Available Metadata Attributes Custom Controls with non-String Attributes Dynamically Creating A CSS Class Validation messages not displaying How to use gridview Bitmap as a Image web control GridView DataSourceID Business-Tier Class |
|||||||||||||||||||||||