// Create our template column. TemplateDataField templateField1 = new TemplateDataField(true); templateField1.Key = "TemplateField1"; templateField1.Header.Text = "Template Column"; templateField1.ItemTemplate.InstantiateIn(LiteralDisplayName); WebDataGrid1.Columns.Add(templateField1);
divHeader.Controls.Add(LiteralHeader); //divDisplayName.Controls.Add(LiteralDisplayName); divDisplayName.Controls.Add(WebDataGrid1);
Hello,
Detailed information about creating a template in code-behind is provided in "Using Item Template" topic. Sample code, as well as a sample application addressing the same requirement is discussed in this thread.
Please, let us know if you need further assistance on this matter.