Solved

Update Panel with a Datagrid populated PageLoad

Posted on 2008-10-01
5
1,944 Views
Last Modified: 2012-05-05
I have a datagrid in a report that is populated at the PageLoad event from parameters passed in the query string.

I would like to put this datagrid in an update panel so that I can display the UpdateProgress while the data is being fetched and then display the results. I can't get the page to render and display the information until it has fetched the data - I have tried (see code snippet) but to no avail.
<asp:ScriptManager ID="ScriptManager" runat="server"></asp:ScriptManager>
    <div id="reportPadding" runat="server" class="reportPagePadding">
    <asp:UpdatePanel ID="ReportPanel" runat="server" >
    <ContentTemplate>
    <div id="divCenter" class="center" runat="server">
        <table id="headerTable" width="100%">
            <tr>
                <asp:Literal ID="AllTestHistoryReportHeader" runat="server"></asp:Literal></tr>
        </table>
        <asp:Literal ID="message" runat="server"></asp:Literal>
        <asp:DataGrid ID="allHistoryData" runat="server" DataKeyField="LearningObjectID"
            AutoGenerateColumns="false" OnItemDataBound="allHistory_ItemDataBound">
            <HeaderStyle Font-Bold="true" HorizontalAlign="Center" />
            <Columns>
                <asp:BoundColumn DataField="TestNumber" HeaderStyle-Width="150" ItemStyle-Width="150"
                    HeaderText="Test Number"></asp:BoundColumn>
                <asp:BoundColumn DataField="Description" HeaderStyle-Width="200" ItemStyle-Width="200"
                    HeaderText="Description" />
                <asp:TemplateColumn HeaderStyle-Width="240" ItemStyle-Width="240" HeaderText="Test Name">
                    <ItemTemplate>
                        <asp:Label ID="lblTestName" runat="server" /></ItemTemplate>
                </asp:TemplateColumn>
                <asp:BoundColumn DataField="Date" DataFormatString="{0:d}" HeaderStyle-Width="100"
                    ItemStyle-Width="100" HeaderText="Date" />
                <asp:BoundColumn DataField="Score" DataFormatString="{0:F0}" HeaderStyle-Width="150"
                    ItemStyle-Width="150" HeaderText="Score  (%)" />
                <asp:BoundColumn DataField="TestStatus" HeaderStyle-Width="150" ItemStyle-Width="150"
                    HeaderText="Test Status" />
                <asp:BoundColumn DataField="Action" HeaderStyle-Width="100" ItemStyle-Width="100"
                    HeaderText="Action" />
            </Columns>
        </asp:DataGrid>
    </div>
       </ContentTemplate>
       </asp:UpdatePanel>
    <asp:UpdateProgress ID="UpdateProgress" runat="server" AssociatedUpdatePanelID="ReportPanel">
    <ProgressTemplate>
    In Progress.....
    </ProgressTemplate>
    </asp:UpdateProgress>
    </div>

Open in new window

0
Comment
Question by:SimonFerris
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 20

Expert Comment

by:informaniac
ID: 22612438
There is no trigger defined to cause an asynchronous postback...

The update progress will be displayed only in case an asynchronous postback is occuring....

For an example have a look here...

http://www.asp.net/learn/3.5-videos/video-362.aspx

In this example the gridview is populated according to the selection in the dropdownlist

Hope this helps...
0
 
LVL 2

Author Comment

by:SimonFerris
ID: 22612702
I have other pages(reports) where there are dropdownlists to specify filters - so thanks for the pointer to the video. In this case the user does not make a choice on the page but has clicked a link on another page that passes the parameter in the query string and the data is fetched.
0
 
LVL 20

Accepted Solution

by:
informaniac earned 250 total points
ID: 22612898
That won't be possible I think...

Because the concept of ajax is that it performs partial updates to the page.

Here u r not perform a update to the page. u r loading it in the first place.

So u'll have to do some workaround...

U could place a lable above the gridview

label1.Text = "Fetching data...";

gv.Datasource=......;
gv.DataBind();
label1.Text=string.Empty;

Hope this helps
0
 
LVL 2

Author Comment

by:SimonFerris
ID: 22613468
Cheers for that I'll give it a go.
0
 
LVL 2

Author Closing Comment

by:SimonFerris
ID: 31501873
Thanks for the quick response. I didn't see any examples out there of how to do this initially and you've helped confirm the way to go.
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to create an MVC5, Razor Widget 2 38
Change to file doesn't show up 16 79
ajax wont trigger twice without a page refresh 7 20
ASP.NET data base connection 35 40
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
jQuery is a JavaScript library that greatly simplifies JavaScript programming. AJAX is an acronym formed from "Asynchronous JavaScript and XML."  AJAX refers to any communication between client and server, when the human client does not observe a…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question