2016 Q1 Breaks Sys.Application.remove_load

4 posts, 1 answers
  1. Richard
    Richard avatar
    23 posts
    Member since:
    Jun 2009

    Posted 06 Feb Link to this post

    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...";
        }
    }

     

  2. Answer
    Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 10 Feb Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Richard
    Richard avatar
    23 posts
    Member since:
    Jun 2009

    Posted 10 Feb in reply to Maria Ilieva Link to this post

    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

     

     

  5. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 11 Feb Link to this post

    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
Back to Top