Access filter container from Page_Load

4 posts, 1 answers
  1. Pau
    Pau avatar
    3 posts
    Member since:
    Jul 2015

    Posted 24 Jul 2015 Link to this post

    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

  2. Pau
    Pau avatar
    3 posts
    Member since:
    Jul 2015

    Posted 24 Jul 2015 Link to this post

    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

  3. Answer
    Angel Petrov
    Admin
    Angel Petrov avatar
    1086 posts

    Posted 29 Jul 2015 Link to this post

    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
  4. Pau
    Pau avatar
    3 posts
    Member since:
    Jul 2015

    Posted 03 Aug 2015 in reply to Angel Petrov Link to this post

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

     Thanks anyway!

Back to Top