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

custom drop down filter for gridboundcolumn

3 Answers 111 Views
Grid
This is a migrated thread and some comments may be shown as answers.
saravanan k
Top achievements
Rank 1
saravanan k asked on 19 Apr 2010, 08:58 AM
Hi all,

        I am new to telrik rad controls. i have a radgrid with grid bound column. i am using a drop down list as filter for this column.
i have achieved this by giving a radcombobox inside the filter template of the column. i have set the datasource id of the drop down to an object data source that fetches data from my business logic layer in the properties window.

The contents of my drop down should vary based on the user who sees the page. i can have multiple object datasource for each user. but i am not sure how to dynamically change the datasource id of this drop down filter from code behind. Please help.

Regards,
Saravanan K

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 19 Apr 2010, 09:19 AM
Hello Saravanan,

You could access the RadComboBox placed in FilterTemplate by using the following code and set the DataSource based on the condition.

ASPX:
 
      . . . 
    <telerik:GridTemplateColumn> 
        <FilterTemplate> 
            <telerik:RadComboBox ID="RadComboBox1" runat="server"
            </telerik:RadComboBox> 
        </FilterTemplate> 
    </telerik:GridTemplateColumn> 
     . . . 

C#;
 
    protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
    { 
        if (e.Item is GridFilteringItem) 
        { 
            GridFilteringItem filterItem = (GridFilteringItem)e.Item; 
            RadComboBox combo = (RadComboBox)filterItem.FindControl("RadComboBox1"); 
            // Set the DataSource for the combo here 
        } 
    } 

Thanks,
Princy.
0
saravanan k
Top achievements
Rank 1
answered on 26 Apr 2010, 01:13 PM
I tried assigning the datasource id and databind the drop down. but now when i change the values in the drop down i am getting

Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: Selection out of range
Parameter name: value

Please help..

Regards,
Saravanan K
0
Pavlina
Telerik team
answered on 29 Apr 2010, 10:00 AM
Hi Saravanan,

Have you compared your implementation with this presented in the following online demos of the product:
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/filtertemplate/defaultcs.aspx
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/filteringtemplatecolumns/defaultcs.aspx

Can you outline the differences between those cases and your configuration? They can lead us to the source of the problem to address it accordingly.

All the best,
Pavlina
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
saravanan k
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
saravanan k
Top achievements
Rank 1
Pavlina
Telerik team
Share this question
or