protected override void OnInit(EventArgs e)
{
base.OnInit(e);
// Create a templated column
TemplatedColumn col = new TemplatedColumn(true);
this.UltraWebGrid1.DisplayLayout.Bands[0].Columns.Add(col);
col.Key = "CheckBoxCol";
col.Header.Caption = "";
GridHeaderTemplate tempHeader = new GridHeaderTemplate();
// Set the header template.
col.HeaderTemplate = tempHeader;
this.UltraWebGrid1.DataSource = LoadGrid();
this.UltraWebGrid1.DataBind();
}
/// Class with implementing the ITemplate
-----------------------------------------------------------
public class GridHeaderTemplate : ITemplate
{
public void InstantiateIn(Control container)
{
// Cast the container to a HeaderItem
HeaderItem headerItem = (HeaderItem)container;
CheckBox checkBox = new CheckBox();
CheckBox cb = new CheckBox();
cb.ID = "headerCB";
cb.Attributes.Add("onclick", "HeaderCheckedChanged();");
headerItem.Controls.Add(cb);
}
}
No comments:
Post a Comment