Click here to Skip to main content
13,147,182 members (30,211 online)
Click here to Skip to main content

Stats

78.9K views
4.1K downloads
55 bookmarked
Posted 14 Jul 2009

Repeater with Paging and Sorting Features

, 16 Jul 2009
Repeater with Paging and Sorting features
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="PagingAndSorting.aspx.cs" Inherits="PagingAndSorting" %>

<!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>
</head>
<body style="font-family: Verdana; font-size: small">
    <form id="form1" runat="server">
    <div style='margin: 5px 5px 5px 5px; border: 1px solid blue; text-align: center;
        <%= Visibility("MSG") %>'>
        No record to display
    </div>
    <div style='margin: 5px 5px 5px 5px; border: 1px solid blue; <%= Visibility("Navigation") %>'>
        <table width="100%" border="0">
            <tr>
                <td align="right">
                    Page Size&nbsp;:&nbsp;<asp:DropDownList ID="ddlPageSize" runat="server" AutoPostBack="true">
                        <asp:ListItem Text="7" Selected="True" Value="7"></asp:ListItem>
                        <asp:ListItem Text="10" Value="10"></asp:ListItem>
                        <asp:ListItem Text="20" Value="20"></asp:ListItem>
                        <asp:ListItem Text="50" Value="50"></asp:ListItem>
                        <asp:ListItem Text="99" Value="99"></asp:ListItem>
                        <asp:ListItem Text="100" Value="100"></asp:ListItem>
                        <asp:ListItem Text="200" Value="200"></asp:ListItem>
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td align="right">
                    <asp:Label ID="lblCurrentPage" runat="server"></asp:Label>
                </td>
            </tr>
            <tr>
                <td align="right">
                    <asp:LinkButton ID="lbtnFirst" runat="server" Text=" first " OnClick="lbtnFirst_Click"></asp:LinkButton>
                    &nbsp; &nbsp;
                    <asp:LinkButton ID="lbtnPrev" runat="server" Text=" previous " OnClick="lbtnPrev_Click"></asp:LinkButton>&nbsp;
                    &nbsp;
                    <asp:LinkButton ID="lbtnNext" runat="server" Text=" next " OnClick="lbtnNext_Click"></asp:LinkButton>
                    &nbsp; &nbsp;
                    <asp:LinkButton ID="lbtnLast" runat="server" Text=" last " OnClick="lbtnLast_Click"></asp:LinkButton>
                </td>
            </tr>
        </table>
    </div>
    <div style='margin: 5px 5px 5px 5px; border: 1px solid blue; <%= Visibility("Repeater") %>'>
        <asp:Repeater ID="rptUsers" runat="server" onitemcommand="rptUsers_ItemCommand">
            <HeaderTemplate>
                <table width="100%" cellpadding="2" cellspacing="2">
                    <tr>
                        <td style="width: 20%; font-weight: bold">
                            <asp:LinkButton ID="lbtnUserName" Text="User Name" runat="server" CommandName="UserName"></asp:LinkButton>
                        </td>
                        <td style="width: 20%; font-weight: bold">
                            <asp:LinkButton ID="lbtnFirstName" Text="First Name" runat="server" CommandName="FirstName"></asp:LinkButton>
                        </td>
                        <td style="width: 20%; font-weight: bold">
                            <asp:LinkButton ID="lbtnLastName" Text="Last Name" runat="server" CommandName="LastName"></asp:LinkButton>
                        </td>
                        <td style="width: 20%; font-weight: bold">
                            <asp:LinkButton ID="lbtnPassword" Text="Password" runat="server" CommandName="Password"></asp:LinkButton>
                        </td>
                        <td style="width: 20%; font-weight: bold">
                            <asp:LinkButton ID="lbtnLastLoginDate" Text="Last Login Date" runat="server" CommandName="LastLoginDate"></asp:LinkButton>
                            
                        </td>
                    </tr>
            </HeaderTemplate>
            <ItemTemplate>
                <tr>
                    <td>
                        <%# Eval("UserName") %>
                    </td>
                    <td>
                        <%# Eval("FirstName") %>
                    </td>
                    <td>
                        <%# Eval("LastName") %>
                    </td>
                    <td>
                        <%# Eval("Password") %>
                    </td>
                    <td>
                        <%# Eval("LastLoginDate") %>
                    </td>
                </tr>
            </ItemTemplate>
            <FooterTemplate>
                </table>
            </FooterTemplate>
        </asp:Repeater>
    </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)

Share

About the Author

bhadeliaimran
Team Leader Softweb Solutions
India India
Profiles : Code Project, ASP.NET Forums
Blog : Knowledgebase World
Current Company : Softwebsolution INC
User Group : Ahmedabad SQLServer UserGroup
Other : Microsoft Certified Technology Specialist (MCTS)

You may also be interested in...

Pro
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.170915.1 | Last Updated 16 Jul 2009
Article Copyright 2009 by bhadeliaimran
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid