Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Advanced ASPX GridView Pagination and Data Entities

, 14 Feb 2013
ASP.NET based software system skeleton that uses the ASPX GridView control and advanced pagination for displaying a list of data entities loaded from the database, and the ASP.NET AJAX ModalPopupExtender control for creating new entities or for editing entities from the grid.
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ContactPage.aspx.cs" Inherits="Ra.GridView.Web.ContactPage" %>

<!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></title>
    <link href="~/Styles/Site.css" rel="stylesheet" type="text/css" />
    <script language="javascript" type="text/javascript">

        function OnOK() {
            window.parent.document.getElementById('_okPopupButton').click();
        }

        function OnCancel() {
            window.parent.document.getElementById('_cancelPopupButton').click();
        }
    </script>
</head>
<body>
    <form id="_mainForm" runat="server">
    <asp:ScriptManager ID="_pageScriptManager" runat="server">
    </asp:ScriptManager>
    <div class="popupContainer">
        <div class="popupTitlebar" id="PopupHeader">
            <div class="titlebarLeft">
                <asp:Literal ID="_titleLiteral" runat="server" Text="Contact" />
            </div>
            <div class="titlebarRight" onclick="OnCancel();">
            </div>
        </div>
        <div class="popupBody">
            <table cellspacing="10px" cellpadding="0px">
               <%-- <tr>
                    <td colspan="6">
                        <asp:ValidationSummary ID="_contactValidationSummary" runat="server" CssClass="failureNotification"
                            ValidationGroup="ContactValidationGroup" />
                    </td>
                </tr>--%>
                <tr>
                    <td>
                        <asp:Literal ID="_firstNameLiteral" runat="server" Text="First Name" />
                    </td>
                    <td>
                        <asp:TextBox ID="_firstNameTextBox" runat="server" Width="170px"></asp:TextBox>
                    </td>
                    <td>
                        <asp:RequiredFieldValidator ID="_firstNameRequired" runat="server" ControlToValidate="_firstNameTextBox"
                            CssClass="failureNotification" ErrorMessage="The First Name is manadatory!" ToolTip="The First Name is manadatory!"
                            ValidationGroup="ContactValidationGroup">*</asp:RequiredFieldValidator>
                    </td>
                    <td>
                        <asp:Literal ID="_lastNameLiteral" runat="server" Text="Last Name" />
                    </td>
                    <td>
                        <asp:TextBox ID="_lastNameTextBox" runat="server" Width="170px"></asp:TextBox>
                    </td>
                    <td>
                        <asp:RequiredFieldValidator ID="_lastNameRequired" runat="server" ControlToValidate="_lastNameTextBox"
                            CssClass="failureNotification" ErrorMessage="The Last Name is manadatory!" ToolTip="The Last Name is manadatory!"
                            ValidationGroup="ContactValidationGroup">*</asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Literal ID="_phoneLiteral" runat="server" Text="Phone" />
                    </td>
                    <td colspan="2">
                        <asp:TextBox ID="_phoneTextBox" runat="server" Width="170px"></asp:TextBox>
                    </td>
                    <td>
                        <asp:Literal ID="_emailLiteral" runat="server" Text="Email" />
                    </td>
                    <td colspan="2">
                        <asp:TextBox ID="_emailTextBox" runat="server" Width="170px"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Literal ID="_groupLiteral" runat="server" Text="Group" />
                    </td>
                    <td colspan="2">
                        <asp:DropDownList runat="server" ID="_groupDropDownList" EnableViewState="true" Width="170px">
                        </asp:DropDownList>
                    </td>
                    <td>
                        <asp:Literal ID="_noteLiteral" runat="server" Text="Note" />
                    </td>
                    <td colspan="2">
                        <asp:TextBox ID="_noteTextBox" runat="server" Width="170px" TextMode="MultiLine"
                            Height="80px"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td colspan="6" style="text-align: center; padding-top: 8px; border-top: 2px; border-top-style: solid;
                        border-top-color: Gray; width: 100%" align="center">
                        <asp:Button ID="_saveButton" Text="Save" runat="server" Width="80px" ValidationGroup="ContactValidationGroup"
                            OnClick="_saveButton_Click" />
                        <asp:Button ID="_cancelButton" runat="server" autopostback="False" Width="80px" Text="Cancel"
                            OnClientClick='OnCancel();' />
                    </td>
                </tr>
            </table>
        </div>
    </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)

About the Author

Raul Iloc
Architect SoftCon IT Services
Romania Romania
I'm currently Project Manager and Software Architect for .NET Development at SOFTCON IT Services SRL Timisoara a subsidiary of SOFTCON AG Munich Germany.
 
I am a senior software engineer with about 18 years working experience in software development and about 13 years as Project Manager and Architect.
I have about 12 years working experience in C# and .NET, 7 years working experience in C++ and Visual C++, 2+ years working experience in Java and J2EE.

| Advertise | Privacy | Mobile
Web03 | 2.8.140721.1 | Last Updated 15 Feb 2013
Article Copyright 2010 by Raul Iloc
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid