insert DropDownList and TextField in Gridview
- by userk
HI,I need to create a GridView which DataSource is an object. Depending on the object I may need some columns with DropDownLists or TextFields (but not all rows)
As I don't know the number or columns, they have to be dynamic. I found this solution:
TemplateField t = new TemplateField();
t.HeaderTemplate = new GridViewTemplate("header", "title");
t.ItemTemplate = new GridViewTemplate("combobox", "val");
GridView1.Columns.Add(t);
GridView1.DataSource = ds;
GridView1.DataBind();
Where GridViewTemplate extends ITemplate.
This didn't work for me, it fills all rows of a column and I had no way to control witch DropDownList and TextFields need to be created (object info).
All the DropDownLists need to have an ID also only known by the object.
There are some way I can do this?