Click here to Skip to main content
15,891,423 members
Articles / Web Development / ASP.NET

ASP.NET Web Form Model with Partial Rendering and Events

Rate me:
Please Sign up or sign in to vote.
4.97/5 (17 votes)
15 Apr 2010CPOL29 min read 93.8K   1.9K   33  
This article explains the Event based ASP.NET Web Form programming model for a web application with reference to partial rendering and AJAX asynchronous postback.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" EnableEventValidation="false" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Data Import</title>
    <link id="Link1" rel="Stylesheet" runat="server" href="CSS/StyleSheet.css" type="text/css" />
    <script src="JavaScript/Common.js"  type="text/javascript"></script>
    <meta http-equiv="Pragma" content="no-cache"/>
</head>
<body>
    <form id="form1" runat="server">
        <div class ="Container">
        <asp:Panel ID="pnlImport" runat="server" Width="100%" CssClass="Page">
                <div>
                <h1 class="Header">
                    <asp:Label runat="server" ID="lblHeading" Text="<%$Resources:EventResources, lblCsvDataImport %>"></asp:Label>
                </h1>    
                <p class="Label">
				    <asp:Label ID="lblFiles" runat="server" Text=""></asp:Label> 
                </p>
		        <asp:GridView ID="gvFiles" runat="server" AutoGenerateColumns="False" CssClass="Gridview" Width="100%">					
		            <Columns>
                          <asp:BoundField HeaderText="<%$Resources:EventResources, gvFileName %>" DataField="FileName"/>
		            </Columns>
                </asp:GridView>			
                </div> 
                <div class="Container">
                    <p class="Buttons">
                            <asp:Button ID="btnImport" runat="server" Text="Import" OnClick="btnImport_Click" OnClientClick=""/> 
                            <asp:Button ID="btnSync" runat="server" Text="Synchronize" OnClick="btnSync_Click" OnClientClick=""/> 
                            <input type='hidden' value='0' runat="server" name='hiddenImportConfirmed' id='hiddenImportConfirmed' />
                            <input type='hidden' value='0' runat="server" name='hiddenSynchedOrNotNew' id='hiddenSynchedOrNotNew' />
                    </p> 
                    <p class="Label">
				            <asp:Label ID="lblImortSyncInfo" runat="server" Text="<%$Resources:eventResources, lblCsvDataImportInfo %>"></asp:Label> 
                    </p>
		            <asp:GridView ID="gvImortSyncInfo" runat="server" AutoGenerateColumns="False" CssClass="GridView" Width="100%">					
		                <Columns>
                              <asp:BoundField HeaderText="<%$Resources:EventResources, gvLastImportFile %>" DataField="LastImportFileName"/>
                              <asp:BoundField HeaderText="<%$Resources:EventResources, gvImportDateTime %>" DataField="LastImportDateTime" dataformatstring="{0:MMM dd, yyyy HH:mm:ss}" HtmlEncode="false"/>
                              <asp:BoundField HeaderText="<%$Resources:EventResources, gvLastsyncFile %>" DataField="LastSyncFileName" />
                              <asp:BoundField HeaderText="<%$Resources:EventResources, gvSyncDateTime %>" DataField="LastSyncDateTime" dataformatstring="{0:MMM dd, yyyy HH:mm:ss}" HtmlEncode="false"/>
		                </Columns>
                    </asp:GridView>			
                </div>
                <div class="Animation">
                        <span id='myHiddenDiv' style='display: none'>
                            <img alt="" src="Images/busy.gif" id='myAnimatedImage'/>
                            <asp:Literal ID="litPleaseWait" runat="server" Text="<%$Resources:EventResources, PleaseWait%>" ></asp:Literal>
                        </span>
                </div>  
            </asp:Panel>
        </div>
    </form>
</body>
</html>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

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


Written By
Software Developer (Senior) Free Lance Consulting
India India
Started my career with Tata Institute of Fundamental Research as Scientific Officer and worked in Project group.
Over 20 years of work experience in C++, C#, ASP.NET, SQL etc. Currently working as a Free Lance Software Consultant, Pune, India.

Comments and Discussions