This is a migrated thread and some comments may be shown as answers.

add filter template dynamically

1 Answer 76 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Tina
Top achievements
Rank 1
Tina asked on 21 Feb 2012, 10:43 AM
How to add a radcombobox in the template column dynamically?
aspx:
<telerik:GridTemplateColumn UniqueName="TemplateColumn" ShowFilterIcon="false" HeaderText="Country">
                   <FilterTemplate></FilterTemplate>
 </telerik:GridTemplateColumn>

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 21 Feb 2012, 11:26 AM
Hello Tina,

Try the following code.
C#:
protected void Radgrid1_ItemCreated(object sender, GridItemEventArgs e)
{
 if (e.Item is  GridFilteringItem)
 {
  GridFilteringItem itm = (GridFilteringItem)e.Item;
  TableCell cell = (TableCell)itm["TemplateColumn"];
  RadComboBox radcombox = new RadComboBox();
  radcombox.ID = "RadComboBox1";
  radcombox.DataSourceID = "SqlDataSource1";
  radcombox.DataTextField = "Name";
  radcombox.DataValueField = "Name";
  cell.Controls.Add(radcombox);
 }
}

-Shinu.
Tags
General Discussions
Asked by
Tina
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or