Please refer the below steps involved to create ItemTemplates programatically:
- In QueryCellStyleInfo event an instance for the TemplateClass of that particular item should be created and assigned it to the EditItemTemplate of that column.
C#
protected void GridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
//Look for the RecordField and AlternateField Cell.
if (e.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell || e.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell)
{
//Look for the Column Name "Column2" in the GridGroupingControl when it get rendered
if (e.TableCellIdentity.Column.Name == "Column2")
{
Join the conversation! Your thoughts help the community grow.