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

Initial load with AJAX

5 Answers 76 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Morten Andreasen
Top achievements
Rank 2
Morten Andreasen asked on 16 Jul 2010, 02:21 PM
Hi

I have some reports that i display in RadGrid that takes a while to generate. Therefore i would like to display the page with some "Loading" Html untill the data is ready.

It is unclear to me, from your documentation whether this is supported by default in RadGrid, or if i should wrap the grid control in a RadAjaxLoadingPanel.

Btv. the examples on EnableAJAXLoadingTemplate are outdated API wise.


Kind regards

5 Answers, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 16 Jul 2010, 02:27 PM
Hi Morten,

You may consider ajaxifying the grid using RadAjaxManager or RadAjaxPanel and display RadAjaxLoadingPanel on initial load as illustrates in this help topic.

Best regards,
Sebastian
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
Morten Andreasen
Top achievements
Rank 2
answered on 16 Jul 2010, 03:05 PM
Hi Sebastian

Im trying hard to follow your example, but i get the following error message:

Message: Sys.InvalidOperationException: Could not find UpdatePanel with ID 'ctl00_webPartManager_g_a4c1cd77_25e2_4eec_8bab_4f41a4cd701b_ctl00_Panel2'. If it is being updated dynamically then it must be inside another UpdatePanel.

It puzzles me that you are using asp:Panel in your example and not asp:UpdatePanel

This is my source code

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="Panel1" LoadingPanelID="RadAjaxLoadingPanel1" />
                <telerik:AjaxUpdatedControl ControlID="residentGrid" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
    <script type="text/javascript">
        function pageLoad(sender, eventArgs) {
            if (!eventArgs.get_isPartialLoad()) {
                $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("InitialPageLoad");
            }
        }      
    </script>
</telerik:RadCodeBlock>
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Height="75px"
    Width="75px" Transparency="50">
    <h1>
        Loading</h1>
</telerik:RadAjaxLoadingPanel>
<asp:Panel ID="Panel1" runat="server">
    <asp:Panel ID="Panel2" Visible="false" runat="server">
        <telerik:RadGrid ID="residentGrid" EnableAJAX="True" EnableAJAXLoadingTemplate="True"
            runat="server" AllowPaging="True" AllowSorting="True" PageSize="20" AutoGenerateColumns="False"
            GridLines="None" OnNeedDataSource="residentGrid_NeedDataSource">
            <MasterTableView>
                <Columns>
                    <telerik:GridBoundColumn HeaderText="AColumn" UniqueName="AColumn" DataField="AColumn" />
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>
    </asp:Panel>
</asp:Panel>


protected void residentGrid_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
    residentGrid.DataSource = ParentWebPart.DataSource;
}
protected void RadAjaxManager1_AjaxRequest(object sender, Telerik.Web.UI.AjaxRequestEventArgs e)
{
    Thread.Sleep(2000);
    residentGrid.DataSource = ParentWebPart.DataSource;
    Panel2.Visible = true;
}

0
Sebastian
Telerik team
answered on 16 Jul 2010, 04:44 PM
Hi Morten,

It seems that the error is produced due to nested MS UpdatePanels in your scenario. Verify that you wrapped the grid in asp Panels as illustrated in the documentation topic and remove any MS UpdatePanel containers. Note that RadAjaxManager injects UpdatePanels around the updated controls on-the-fly.

Best regards,
Sebastian
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
Morten Andreasen
Top achievements
Rank 2
answered on 17 Jul 2010, 01:15 PM
Im not using update panels - see code
0
Sebastian
Telerik team
answered on 19 Jul 2010, 09:00 AM
Hello Morten,

From the id of the panel you provided I suppose that you use the grid in web part scenario with master/content pages - is this information correct? If so, double-check that you have not wrapped any content place holder (or other container) which hosts the grid in MS UpdatePanel, RadAjaxPanel or ajaxified it with RadAjaxManager.

If this does not help, I suggest you post the entire markup and code-behind of the page(s) which are related to the grid in this forum post. I will examine them in detail and will get back to you with my findings.

Regards,
Sebastian
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
Tags
Grid
Asked by
Morten Andreasen
Top achievements
Rank 2
Answers by
Sebastian
Telerik team
Morten Andreasen
Top achievements
Rank 2
Share this question
or