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

Disable sorting / paging / filtering programmatically

2 Answers 235 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jp Maxwell
Top achievements
Rank 1
Jp Maxwell asked on 22 Jun 2010, 04:33 PM
Hi!
I'm trying to disable sorting / paging / filtering on my grid according some condition on the page.

The  code is the following

            grid.AllowPaging = false;
            grid.AllowSorting = false;
            grid.AllowFilteringByColumn = false;

This code doesn't work as expected. If I disable everything, the rendered grid has everything enabled and it's disabled ON NEXT postback. So It works, but with delay. The same if I try to enable everything again.

I placed that code on different events on the page / grid life cycle with no luck. Same behavior. I want to disable those commands and immediately see them disabled, not on next postback.

Thanks!

2 Answers, 1 is accepted

Sort by
0
Accepted
Pavlina
Telerik team
answered on 23 Jun 2010, 12:10 PM
Hi Jp,

Examine the code snippet bellow and let me know if it works as expected:
C#:
protected void RadGrid1_PreRender(object sender, EventArgs e)
    {
        RadGrid1.AllowPaging = false;
        RadGrid1.AllowSorting = false;
        RadGrid1.AllowFilteringByColumn = false;
        RadGrid1.Rebind();
    }

I hope this helps.

Regards,
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
0
Jp Maxwell
Top achievements
Rank 1
answered on 23 Jun 2010, 03:52 PM
I can't add this code on render event but it helped me to understand that I have to set those properties before a rebind.
Thanks!
Tags
Grid
Asked by
Jp Maxwell
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Jp Maxwell
Top achievements
Rank 1
Share this question
or