<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Loader Image While Loading Data in GV.aspx.cs" Inherits="Loader_Image_While_Loading_Data_in_GV" %> <!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 runat="server"> <title>Loader Image While Loading Data in GV</title> </head> <body> <form id="form1" runat="server"> <div> <table> <tr> <td> <asp:Image ID="load_img" runat="server" Height="70px" Width="70px" ImageUrl="~/Images/ajax-loader_green.gif" Visible="false" /> </td> </tr> <tr> <td> <asp:Button ID="btnload" runat="server" Text="Load" OnClick="btnload_Click" /> </td> </tr> <tr> <td> <asp:GridView ID="gv1" runat="server" BackColor="LightGoldenrodYellow" BorderColor="Tan" BorderWidth="1px" CellPadding="2" ForeColor="Black" GridLines="None"> <AlternatingRowStyle BackColor="PaleGoldenrod" /> <FooterStyle BackColor="Tan" /> <HeaderStyle BackColor="Tan" Font-Bold="True" /> <PagerStyle BackColor="PaleGoldenrod" ForeColor="DarkSlateBlue" HorizontalAlign="Center" /> <SelectedRowStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" /> <SortedAscendingCellStyle BackColor="#FAFAE7" /> <SortedAscendingHeaderStyle BackColor="#DAC09E" /> <SortedDescendingCellStyle BackColor="#E1DB9C" /> <SortedDescendingHeaderStyle BackColor="#C2A47B" /> </asp:GridView> </td> </tr> </table> </div> </form> </body> </html>
<pre lang="cs">using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using AdventureWorksModel; public partial class Loader_Image_While_Loading_Data_in_GV : System.Web.UI.Page { AdventureWorksEntities awe = new AdventureWorksEntities(); protected void Page_Load(object sender, EventArgs e) { } protected void btnload_Click(object sender, EventArgs e) { load_img.Visible = true; gv1.DataSource = awe.CountryRegionCurrencies.ToList(); gv1.DataBind(); load_img.Visible = false; } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)