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

Access filter container from Page_Load

3 Answers 69 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Pau
Top achievements
Rank 1
Pau asked on 24 Jul 2015, 01:42 PM

Hi,

I have a fully programmatically implemented Radgrid, with filters enabled. When you implement a Filter Template Class (to make a custom filter), you have to implement the function InstantiateIn, which has the container as a parameter. In this function you add the components of your Filter Template to this container, but I want to add controls to the container from outside this function. ​Is it possible to find this container form the Page_Load function? I've serached everything, and I have seen that you can get it at ItemCreated or ItemDataBound, I don't exactly remember. But this is not what I want, I want to get it from Page_Load. How can I do that?

 Thanks

3 Answers, 1 is accepted

Sort by
0
Pau
Top achievements
Rank 1
answered on 24 Jul 2015, 01:45 PM

Sorry I forgot to say that I only want to do this on postback, not at first time the page loads. I don't know if the grid is already there on postback or what.

 Thanks

0
Accepted
Angel Petrov
Telerik team
answered on 29 Jul 2015, 07:29 AM
Hello,

I am not sure about the exact implementation here but the filter controls should be initialized inside the GridFilterItem cells. That said you should be able to access the container using the following code.

C#:
TableCell cell = (RadGrid1.MasterTableView.GetItems(GridItemType.FilteringItem)[0] as GridFilteringItem)["TheColumnName"];
Have in mind that if the logic will be used inside the page load event you should ensure that the grid is already initialized.

Regards,
Angel Petrov
Telerik
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 Feedback Portal and vote to affect the priority of the items
0
Pau
Top achievements
Rank 1
answered on 03 Aug 2015, 08:48 AM

Yes sorry! I found this by myself but I forgot to say here. And it worked!

 Thanks anyway!

Tags
Grid
Asked by
Pau
Top achievements
Rank 1
Answers by
Pau
Top achievements
Rank 1
Angel Petrov
Telerik team
Share this question
or