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

Not answered how can i attach a RadFilter to a RadGrid which is located in a user control

5 Answers 146 Views
Filter
This is a migrated thread and some comments may be shown as answers.
rashad kabbara
Top achievements
Rank 1
rashad kabbara asked on 30 Jun 2010, 09:19 AM
i have a RadGrid in a usercontrol.
i have an aspx page that contains the usercontrol and a RadFilter.
how can i assign the FilterContainerID of the RadFilter to the RadGrid?

i already tried to directly giving it the ID as such:

 

<telerik:RadFilter 

ID="rfCustomFilter" runat="server"FilterContainerID="RadGrid1"/>

and i have also tried to assign filterContainerID in code behind as such:
rfCustomFilter.FilterContainerID = "RadGrid1";

both did not work, and i get an error when Adding an expression:
Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

5 Answers, 1 is accepted

Sort by
0
SamJ
Top achievements
Rank 1
answered on 01 Jul 2010, 08:21 AM
Hi,

Indeed, you can try setting the FilterContainer property in the page code-behind for instance on Page_Load. But instead of hardcoding the grid ID as you did, try finding the RadGrid control and set the RadFilter property as below:

RadGrid myGrid = <YourUserControl>.FindControl("RadGrid1"as RadGrid; 
rfCustomFilter.FilterContainer = myGrid; 

I hope this helps.

SamJ
0
rashad kabbara
Top achievements
Rank 1
answered on 02 Jul 2010, 06:32 AM
it won't work since FilterContainer is read only and cannot be assigned to.
any other possible solutions?

 

0
SamJ
Top achievements
Rank 1
answered on 02 Jul 2010, 06:52 AM
What about setting the FilterContainerID like this:

RadGrid myGrid = <YourUserControl>.FindControl("RadGrid1"as RadGrid;  
rfCustomFilter.FilterContainerID = myGrid.ID; 

0
Kevin
Top achievements
Rank 1
answered on 10 Nov 2010, 12:25 PM
I am in the exact same predicament.  Has anyone figured out a solution or a workaround?
0
Devman
Top achievements
Rank 1
answered on 21 Aug 2011, 12:10 PM
I have the same problem. There are a some ideas?

Thanks.
Tags
Filter
Asked by
rashad kabbara
Top achievements
Rank 1
Answers by
SamJ
Top achievements
Rank 1
rashad kabbara
Top achievements
Rank 1
Kevin
Top achievements
Rank 1
Devman
Top achievements
Rank 1
Share this question
or