Hello Anyone,
I guess i am missing something here. I have created an ITemplate as below and adding it to the FilterTemplate of one of the column of RadGrid.
On first load, i see the template added to the column. But when i click on the Apply button, the template vanishes; i do not see it. I am adding the template on the ColumnCreated event of the radgrid as below:
Can someone please let me know where i am going wrong? Do i need to add the filtertemplate in a different event?
I guess i am missing something here. I have created an ITemplate as below and adding it to the FilterTemplate of one of the column of RadGrid.
public
class
cblItemTemplate : ITemplate
{
/// <summary>
/// Create the template
/// </summary>
/// <param name="container"></param>
public
void
InstantiateIn(Control container)
{
Panel pnl =
new
Panel();
//checkbox
CheckBoxList cbl =
new
CheckBoxList();
cbl.ID =
"cblCounty"
;
cbl.AutoPostBack =
false
;
cbl.DataBinding += cbl_DataBinding;
//button
Button btn =
new
Button();
btn.ID =
"btnApply"
;
btn.Text =
"Apply"
;
//button
Button btnClear =
new
Button();
btnClear.ID =
"btnClear"
;
btnClear.Text =
"Clear"
;
pnl.Controls.Add(cbl);
pnl.Controls.Add(btn);
pnl.Controls.Add(btnClear);
container.Controls.Add(pnl);
}
void
cbl_DataBinding(
object
sender, EventArgs e)
{
CheckBoxList cbl = (CheckBoxList)sender;
cbl.Items.Add(
new
ListItem(
"County1"
));
cbl.Items.Add(
new
ListItem(
"County2"
));
}
}
On first load, i see the template added to the column. But when i click on the Apply button, the template vanishes; i do not see it. I am adding the template on the ColumnCreated event of the radgrid as below:
protected
void
RadGrid1_ColumnCreated(
object
sender, GridColumnCreatedEventArgs e)
{
if
(col.UniqueName ==
"county"
)
{
var cbl =
new
cblItemTemplate();
col.FilterTemplate = cbl;
}
}
Can someone please let me know where i am going wrong? Do i need to add the filtertemplate in a different event?