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

[Solved] dynamic filter combox

1 Answer 129 Views
Grid
This is a migrated thread and some comments may be shown as answers.
I. Breukink
Top achievements
Rank 1
I. Breukink asked on 08 Feb 2010, 04:34 PM
I already create a complete grid in the cs code. This grid is working fine, but now I want to create in the same c# code a combo selection-box as http://demos.telerik.com/aspnet-ajax/grid/examples/programming/filtertemplate/defaultcs.aspx  I want to supply the selection items which have to fill the combobox, so they don't have to be loaded using a datasource.
I have been looking and working with several samples using eg ITemplate, but i'm notting getting it to work. How can I create this?

Thanks

1 Answer, 1 is accepted

Sort by
0
Accepted
Tsvetoslav
Telerik team
answered on 11 Feb 2010, 11:44 AM
Hi Breukink,

There is no problem to add the items into the combo box manually. You should do so in the overridden SetUpFilterControls method. Here is an example:

protected override void SetupFilterControls(TableCell cell)
{
    RadComboBox rcBox = new RadComboBox();
    rcBox.ID = "DropDownList1";
    rcBox.Width = Unit.Percentage(100);
    rcBox.AutoPostBack = true;
    rcBox.SelectedIndexChanged += rcBox_SelectedIndexChanged;
 
    RadComboBoxItem item = new RadComboBoxItem("Bulgaria", "Bulgaria");
    rcBox.Items.Add(item);
    item = new RadComboBoxItem("St. Helen's Island", "St. Helen's Island");
    rcBox.Items.Add(item);
    item = new RadComboBoxItem("Italy", "Italy");
    rcBox.Items.Add(item);
 
    cell.Controls.Add(rcBox);
}

I hope this helps.

Greetings,
Tsvetoslav
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Grid
Asked by
I. Breukink
Top achievements
Rank 1
Answers by
Tsvetoslav
Telerik team
Share this question
or