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

Page_Load called twice when using HeaderContextFilterMenu

1 Answer 176 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Stuart Watton
Top achievements
Rank 2
Stuart Watton asked on 08 Aug 2011, 05:55 PM
We have RadGrids on several pages which all work in the same way and all show the same problem.

They all have EnableHeaderContextFilterMenu set to true and they all only work every other time the users try to filter using this method. When other commands on the header centext menus are called the Page_Load and Page_Init are only called once, However when filtering these sections are called twice, with different values for Page.IsPostBack and RadAjaxManager1.IsAjaxRequest

Let me go through a sequence of events:
User Navigates to the Page
    Page_Load gets called
        Page.IsPostBack = False
        RadAjaxManager1.IsAjaxRequest = False

So far this is exactly what I would expect
Now Lets try to filter the grid

Filter Request = qty Greater Than 2000
    Page_Load
        Page.IsPostBack = False
        RadAjaxManager1.IsAjaxRequest = False
    Page_Load
        Page.IsPostBack = True
        RadAjaxManager1.IsAjaxRequest = True

So the Grid is now filtered correctly but the AjaxLoadingPanel did not appear whilst it was working on the server side, and Page_Load is called twice.
So lets change the filter now to be Less than 2000 rather than Greater than.

Filter Request = qty Less Than 2000 - AjaxLoadingPanel is Activated
    Page_Load
        Page.IsPostBack = True
        RadAjaxManager1.IsAjaxRequest = False
    Page_Load
        Page.IsPostBack = True
        RadAjaxManager1.IsAjaxRequest = True

Notice the different value of IsPostBack the first time Page_Load is called now. This time theAjaxLoadingPanel is shown but the Page actually performs a full Postback and the contents of the grid are left as they were showing the values Greater than 2000.

Does anyone have a clue as to what might be causing this strange behaviour?






1 Answer, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 11 Aug 2011, 11:44 AM
Hi Stuart,

Make sure that you are using Advanced data-binding and not simple data-binding. Also please note that when you are using  Advance data-binding you do not have calls to the grid's DataBind() method anywhere in the code (only Rebind() should be used when the grid is to be repopulated).
If this is not the problem it will be best to open up a formal support ticket and send your files as an attachment.Thus we will be able to debug them locally and advise you further. 

All the best,
Maria Ilieva
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
Grid
Asked by
Stuart Watton
Top achievements
Rank 2
Answers by
Maria Ilieva
Telerik team
Share this question
or