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

Efficient Server-Side View State Persistence

Rate me:
Please Sign up or sign in to vote.
4.96/5 (28 votes)
8 Aug 2008Ms-PL7 min read 125.7K   1.2K   62  
Increasing the performance of your ASP.NET website by reducing the download footprint of your pages.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ViewStateInPage.aspx.cs" Inherits="ViewStateInPage" %>

<!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>ViewState In Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        <asp:Button ID="Button1" runat="server" Text="Make New Record" 
            onclick="Button1_Click" />
    </div>
    <div>
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false" onrowdatabound="GridView1_RowDataBound">
            <Columns>
                <asp:TemplateField HeaderText="Time">
                    <ItemTemplate>
                        <asp:Literal ID="Field1" runat="server"></asp:Literal>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Ticks">
                    <ItemTemplate>
                        <asp:Literal ID="Field2" runat="server"></asp:Literal>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Random String">
                    <ItemTemplate>
                        <asp:Literal ID="Field3" runat="server"></asp:Literal>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
    </div>
    <asp:HyperLink ID="hlnkDefault" runat="server" NavigateUrl="~/Default.aspx" Text="Back to Default"></asp:HyperLink>
    </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 Microsoft Public License (Ms-PL)


Written By
Team Leader ICAN
United States United States
Jason Monroe is a Project Manager / Architect with the ICAN grant for the Indiana Department of Education. He has been a professional software developer for 13 years, with the last 8 years focusing on Microsoft technologies.

Comments and Discussions