M
Miles
I want to expand the standard ASP.Net Datagrid so I have a class that
inherits from it...
public class MyDataGrid : System.Web.UI.WebControls.DataGrid, INamingContainer
I want to add a control after the footer when the enhanced datagrid control
is rendered. This control is a button so I added it in the following
override...
protected override void CreateChildControls()
{
base.CreateChildControls ();
//cmdAddToList declared at class scope
cmdAddToList = new Button();
cmdAddToList.ID = "cmdAddToList";
cmdAddToList.Text = "Add to List";
cmdAddToList.Click += new EventHandler(cmdAddToList_Click);
this.Controls.Add(cmdAddToList);
}
And the Render is overridden as per MSDN...
protected override void Render(HtmlTextWriter writer)
{
this.EnsureChildControls();
base.Render(writer);
}
Problem is, the button control is not added. If a postback is done by
another standard control on the datagrid then is appears!
Any clues qould be appreciated.
inherits from it...
public class MyDataGrid : System.Web.UI.WebControls.DataGrid, INamingContainer
I want to add a control after the footer when the enhanced datagrid control
is rendered. This control is a button so I added it in the following
override...
protected override void CreateChildControls()
{
base.CreateChildControls ();
//cmdAddToList declared at class scope
cmdAddToList = new Button();
cmdAddToList.ID = "cmdAddToList";
cmdAddToList.Text = "Add to List";
cmdAddToList.Click += new EventHandler(cmdAddToList_Click);
this.Controls.Add(cmdAddToList);
}
And the Render is overridden as per MSDN...
protected override void Render(HtmlTextWriter writer)
{
this.EnsureChildControls();
base.Render(writer);
}
Problem is, the button control is not added. If a postback is done by
another standard control on the datagrid then is appears!
Any clues qould be appreciated.