G
Gordon
Hi,
Fairly new to ASP.net. I want to create a Datagrid that will bind to a
DataSet created a runtime and which will hence have a variable number of
columns. I want to show the data in binded textboxes.
I can't create template columns in the designer because I don't know the
number and column name but I can see how to do it at runtime ie in Page_Init
for (int counter=0;counter<dataSet1.Columns.count; counter++) {
TemplateColumn dc = new TemplateColumn()
dc.HeadText = dataset1.Columns[counter].ColumnName
DataGrid1.Columns.Add(dc)
}
but I'm a bit lost on how to add an ItemTemplate which has a bound textbox
to each TemplateColumn as I create them
Fairly new to ASP.net. I want to create a Datagrid that will bind to a
DataSet created a runtime and which will hence have a variable number of
columns. I want to show the data in binded textboxes.
I can't create template columns in the designer because I don't know the
number and column name but I can see how to do it at runtime ie in Page_Init
for (int counter=0;counter<dataSet1.Columns.count; counter++) {
TemplateColumn dc = new TemplateColumn()
dc.HeadText = dataset1.Columns[counter].ColumnName
DataGrid1.Columns.Add(dc)
}
but I'm a bit lost on how to add an ItemTemplate which has a bound textbox
to each TemplateColumn as I create them