I want to create a custom server control that uses the DataGrid control.
I have something like:
public class Grid : DataGrid
{
public Grid()
{
.....
}
public ICollection CreateDataSource()
{
.....
}
protected BoundColumn AddBoundColumn(String strHeaderText, String
strDataField)
{
BoundColumn bCol = new BoundColumn();
bCol.HeaderText = strHeaderText;
bCol.DataField = strDataField;
return bCol;
}
public void OnLoad(Object s, EventArgs e)
{
this.DataSource = CreateDataSource();
this.Columns.Add(AddBoundColumn("someText", "someField"));
this.DataBind();
}
}
This work fine if I have only columns of type BoundColumn but I want to
add a TemplateColumn. Is there a way to do that ?
Thanks !