0

I have few text fields in my c# page.When the user fills those fields and clicks on submit button, a Gridview is displayed as the result.

The problem here is that, the gridview will take long time to get fully populated since the query that runs behind scans large amounts of data.

So till the Gridview is getting popluated I was to display a Loading image so that users don't feel that system has crashed.I dont want to insert sleep statement like most of the examples shown on the net as that will increase my total time for output.How should I go about? Please Help!

   <form id="form1" runat="server">
     <div>
     <b>Enter value 1 :</b>
        <asp:TextBox id="p1" runat="server" /> <br />
     <b>Enter value2 :</b>
        <asp:TextBox id="p2" runat="server" /><br />
        <asp:Button ID="btn1" runat="server" OnClick="Button1_Click" Text="Start Search"/>
        <hr />

         <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <asp:updatepanel id="ResultsUpdatePanel" runat="server">    
    <contenttemplate>

    <div style="text-align:center;">
    <asp:updateprogress id="UpdateProgress1" runat="server" associatedupdatepanelid="ResultsUpdatePanel" dynamiclayout="true">
                        <progresstemplate>

                           <img src="loader.gif">

                        </progresstemplate>
                    </asp:updateprogress>

                    </div>

         <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="true"
                    OnPageIndexChanging="gridView_PageIndexChanging"
                    CssClass="gridstyle" 
                    EnableViewState="false"
                    AllowPaging="true">
                    <AlternatingRowStyle CssClass="altrowstyle" />
                    <HeaderStyle CssClass="headerstyle" />
                    <RowStyle CssClass="rowstyle" />
                    <RowStyle Wrap="false" />
                    <HeaderStyle Wrap="false" />
                </asp:GridView>
    </contenttemplate>
</asp:updatepanel>
    </div>
    </form>
Ankita
  • 83
  • 2
  • 15
  • I think you'll find the answer here : http://stackoverflow.com/questions/2813590/ajax-loading-icon-with-updatepanel-postbacks . the first thing would be to use an updatepanel so that your request is asynchrone. – Laurent S. Jun 26 '13 at 15:50
  • @Bartdude thank you.I tried doing that but still no progress. I have pastes that part of my code in my question.Can you please have a look at it and tell me where I am making mistake.Thank you. – Ankita Jun 26 '13 at 16:25
  • i don't see no code for now but your edit is probably being reviewed. Anyway a description of the problem may help also : do you get an error message ? – Laurent S. Jun 26 '13 at 16:28
  • @Bartdude Can you see the code now? – Ankita Jun 26 '13 at 16:30
  • Yes, but that's only your aspx code, where's the codebehind ? – Laurent S. Jun 26 '13 at 16:33
  • I am sorry but since I am new to this I am not understanding what should I add to my protected void Button1_Click(object sender,EventArgs e){} function regarding the update progress.To display the loading symbol I have not made any changes in my .cs file. – Ankita Jun 26 '13 at 16:37
  • The best would be to create a new question, post you relevant code (aspx + cs file), and explain what your problem is. "This is not working" isn't an explanation. Anyone willing to help will need your code and a description of your problem. – Laurent S. Jun 26 '13 at 16:40
  • sure I can do that.Thank you for your time! – Ankita Jun 26 '13 at 16:41

0 Answers0