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

2016 Q1 Breaks Sys.Application.remove_load

3 Answers 320 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Richard asked on 06 Feb 2016, 03:21 PM

In order to make my pages containing RadGrids more responsive, I load the page with no data and then retrieve the data in a postback.

This worked great until I tried running it with the latest Telerik UI controls (2016 Q1). Now, the remove_load does not seem to work, so the data is continually reloaded.

Any ideas?

The code on my aspx page is as follows:

<script type="text/javascript">
    function rebindGrid(clientid) {
        var grid = $find(clientid);
        if (grid == null)
            return;
        if (typeof (grid.get_masterTableView) != "function")
            return;
        var masterTable = grid.get_masterTableView();
        if (masterTable != null)
            masterTable.rebind();
    }
 
    function rebindPageGrid() {
        Sys.Application.remove_load(rebindPageGrid);
        rebindGrid("<%= AccountGrid.ClientID %>");
    }
 
    Sys.Application.add_load(rebindPageGrid);
</script>

The code behind looks like:

protected void OnAccountGridNeedDataSource(object source, GridNeedDataSourceEventArgs e)
{
    if (Page.IsPostBack)
    {
        AccountGrid.DataSource = GetAccountList();
        AccountGrid.MasterTableView.NoMasterRecordsText = "No records to display";
    }
    else
    {
        AccountGrid.DataSource = new List<Account>();
        AccountGrid.MasterTableView.NoMasterRecordsText = "Loading Data...";
    }
}

 

3 Answers, 1 is accepted

Sort by
0
Accepted
Maria Ilieva
Telerik team
answered on 10 Feb 2016, 10:36 AM
Hi Richard,

Please revise the answer provided in the official support ticket you have opened for the same issue and see if it helps. I would suggest you to continue our communication in the support thread so that we can easily track your case.

Regards,
Maria Ilieva
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
Richard
Top achievements
Rank 1
answered on 10 Feb 2016, 06:28 PM

In this case, a little more context provides the answer:

<telerik:RadScriptBlock runat="server">
    <script type="text/javascript">
        function rebindPageGrid() {
            Sys.Application.remove_load(rebindPageGrid);
            rebindGrid("<%= AccountGrid.ClientID %>");
        }
        Sys.Application.add_load(rebindPageGrid);
    </script>
</telerik:RadScriptBlock>

The RadScriptBlock should be replaced with a RadCodeBlock.

You can read more about the difference at:

http://docs.telerik.com/devtools/aspnet-ajax/controls/ajax/radcodeblock-and-radscriptblock

 

 

0
Maria Ilieva
Telerik team
answered on 11 Feb 2016, 07:57 AM
Hi Richard,

I hope chaining the RadScriptBlock with RadCodeBlock helped in your case. Do let us know if further assistance in this issue is needed.

Regards,
Maria Ilieva
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
Tags
Grid
Asked by
Richard
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Richard
Top achievements
Rank 1
Share this question
or