S
Susil Patro
Hi all,
We are facing a problem while using ASP.NET Datagrid Template Columns
generated dynamically.
Scenario:
-------------
1) We have a custom datagrid control class (inheriting from
System.Web.UI.WebControls.DataGrid).
In the constructor of the class we dynamically register the
OnSortCommand for the grid.
2) We have another custom CustomHeaderTemplate class inheriting from
ITemplate, which we are using to customize the header
column template for our custom DataGrid control.
3) In the BindData event of this class, we are adding a LinkButton an
set the properties as follows.
---
DataGridItem container = (DataGridItem) pnl.NamingContainer;
LinkButton lb = new LinkButton();
lb.Text = "Employee Name";
lb.CommandName = "sort";
lb.CommandArgument = "EmpName"; //Name of the Column in the grid
DataSource
container.Controls.Add(tb);
---
4) In the aspx page containing the grid, we are setting the
HeaderTemplate of the grid to this custom class
DataGridObject.HeaderTemplate = new CustomHeaderTemplate ();
5) The Link buttons appear fine in the column header, but when we
click on it, the OnSortCommand command of our custom datagrid does not
fire.
Could anyone please let know what else needs to be done in order for
the Sort Command to fire in the case of dynamic DataGrid Template
Columns?
Appreciate your help and thanks in advance.
Regards,
Susil Patro
We are facing a problem while using ASP.NET Datagrid Template Columns
generated dynamically.
Scenario:
-------------
1) We have a custom datagrid control class (inheriting from
System.Web.UI.WebControls.DataGrid).
In the constructor of the class we dynamically register the
OnSortCommand for the grid.
2) We have another custom CustomHeaderTemplate class inheriting from
ITemplate, which we are using to customize the header
column template for our custom DataGrid control.
3) In the BindData event of this class, we are adding a LinkButton an
set the properties as follows.
---
DataGridItem container = (DataGridItem) pnl.NamingContainer;
LinkButton lb = new LinkButton();
lb.Text = "Employee Name";
lb.CommandName = "sort";
lb.CommandArgument = "EmpName"; //Name of the Column in the grid
DataSource
container.Controls.Add(tb);
---
4) In the aspx page containing the grid, we are setting the
HeaderTemplate of the grid to this custom class
DataGridObject.HeaderTemplate = new CustomHeaderTemplate ();
5) The Link buttons appear fine in the column header, but when we
click on it, the OnSortCommand command of our custom datagrid does not
fire.
Could anyone please let know what else needs to be done in order for
the Sort Command to fire in the case of dynamic DataGrid Template
Columns?
Appreciate your help and thanks in advance.
Regards,
Susil Patro