Click here to Skip to main content
15,885,869 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
have a tabcontainer with three panel,inside that i have gridview when i user click on the tab the gridview is loaded ,i want till the gridview is loading a img gif should be shown,and should got hide after the grid loads completly for that i had written code as

ASP.NET
<%@ Page Language="C#" AutoEventWireup="true"  CodeBehind="example.aspx.cs"     Inherits="example" %>  <%@ Register Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"     Namespace="System.Web.UI" TagPrefix="asp" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1"  runat="server">      <script type="text/javascript">         
 $(function() {            $("#mytab").mytab({                 ajaxOptions: {                     type: 'POST',                     data: postData,                     beforeSend: function() {                         $('#loader').show();                     },                     complete: function() {                         $("#loader").hide();                     }                 }             });         });  </script>   </head> <body>     <form id="form2"  runat="server">     <iframe id="iFrame2"  runat="server" height="2px" width="2px"></iframe>         <asp:UpdatePanel ID="UpdatePanel2" runat="server">     <contenttemplate>     <div>         <asp:ScriptManager ID="ScriptManager2" runat="server" EnablePartialRendering="true">                </div>   <asp:Panel ID="loader" runat="server" Wrap="true" CssClass="body"  >                     <table cellpadding="5" cellspacing="5" style="width:322px; height:245px; border:1">                         <tr>                             <td style="width:322px; height:245px; border:1">                                 <asp:Image ID="Image1" Width="322px" Height="245px" BorderWidth="0" runat="server" ImageUrl="Images/loading.gif" />                             </td>                         </tr>                     </table>                          <cc1:TabContainer ID="mytab"  runat="server"  Width="100%"                                 Visible="true" AutoPostBack="true" >                                 <cc1:TabPanel  runat="server"   HeaderText="application" ID="TabPanel1"                                      >                                     <contenttemplate>                                     <asp:Panel ID="Panel1" runat="server">                                         <table class="outline-tabs">                                             <tr class="pagination-row">                                              </tr>                                             <tr>                                                 <td>                                                     <asp:UpdatePanel ID="UpdatePanel3" runat="server">                                                         <contenttemplate>                                                             <asp:GridView ID="GridView1" runat="server" CssClass="tblGrid" AllowSorting="True">                                                                                                               </contenttemplate>                                                                                                      </td>                                             </tr>                                          </table>                                                                           </contenttemplate>                                                 </contenttemplate>          </form> </body> </html> 

but when i run the application i get a error as Microsoft JScript runtime error: Object expected what is wrong in the above code,any file is missing,since i m using jquery
Posted
Updated 21-Jul-12 6:02am
v3
Comments
WoodenLegNamedSmith 21-Jul-12 12:01pm    
your TabContainer and TabPanel controls are prefixed with cc1, meaning its a custom control, make sure that it is registered and referenced in your project dependencies before building.

1 solution

You can show your loading image using Update Progress since you are already using Update Panel.

Have a look at these samples to understand the implementation and working of Update Progress:
MSDN: UpdateProgress Control Overview[^]
CP: The UpdateProgress Control of ASP.NET AJAX Extensions[^]
AJAX.NET UpdateProgress control[^]
ASPNET Tutorial: Introduction to AJAX UpdateProgress Control in ASP.NET and C#[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900