当前位置:编程学习 > asp >>

Repeater 自定义分页+排序+全选删除

[csharp]
页面代码: 
 
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="RepeaterPagingSortingDelete.aspx.cs" Inherits="RepeaterPagingSortingDelete" %> 
 
<!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>RepeaterPagingSortingDelete</title>  
    <script language="javascript" type="text/javascript">  
        function chooseAll(sender)  
        {  
            var inputs = document.all.tags("INPUT");  
            // 遍历页面上所有的 input   
            for (var i = 0; i < inputs.length; i++)   
            {         
                    //如果此input元素的类型为checkbox,并且其id中包含chkSelect  
                    if (inputs[i].type == "checkbox" && inputs[i].id.indexOf("chkSelect") >= 0)  
                    {  
                        //设置此复选框的checked与全选复选框相同  
                        inputs[i].checked = document.getElementById(sender).checked;  
                        inputs[i].onclick();  
                    }   
            }  
        }  
          
        function highLightSelected(chkSelect)  
        {   
            if (chkSelect.checked)   
                chkSelect.parentElement.parentElement.style.backgroundColor='#CCCCFF';   
            else   
                chkSelect.parentElement.parentElement.style.backgroundColor='white';   
        }  
    </script>  
</head>  
<body>  
    <form id="form1" runat="server">  
    <div>  
        <asp:LinkButton id="lbtnFirst" runat="server" CommandName="First" OnCommand="lbtnPage_Command">|<</asp:LinkButton>    
        <asp:LinkButton id="lbtnPrevious" runat="server" CommandName="Previous" OnCommand="lbtnPage_Command"><<</asp:LinkButton>    
        <asp:Label id="lblMessage" runat="server" />    
        <asp:LinkButton id="lbtnNext" runat="server" CommandName="Next" OnCommand="lbtnPage_Command">>></asp:LinkButton>    
        <asp:LinkButton id="lbtnLast" runat="server" CommandName="Last" OnCommand="lbtnPage_Command">>|</asp:LinkButton>    
        转到第<asp:DropDownList ID="dropPage" runat="server" AutoPostBack="True" OnSelectedIndexChanged="dropPage_SelectedIndexChanged"></asp:DropDownList>页          
        <asp:Repeater ID="rptProducts" runat="server"   
            onitemcreated="rptProducts_ItemCreated"   
            onitemdatabound="rptProducts_ItemDataBound">  
            <HeaderTemplate>  
                <table border="1">  
                <tr>  
                    <td id="tdAll" runat="server"><asp:CheckBox ID="chkAll" runat="server" /></td>  
                    <td id="tdProductID" runat="server"><asp:LinkButton ID="lbtnProductID" runat="server" Text="ProductID" CommandName="ProductID" OnCommand="lbtnSort_Command"></asp:LinkButton><asp:Label ID="lblHeadProductID" runat="server" Visible="false"></asp:Label></td>  
                    <td id="tdProductName" runat="server"><asp:LinkButton ID="lbtnProductName" runat="server" Text="ProductName" CommandName="ProductName" OnCommand="lbtnSort_Command"></asp:LinkButton><asp:Label ID="lblProductName" runat="server" Visible="false"></asp:Label></td>  
                    <td id="tdSupplierID" runat="server"><asp:LinkButton ID="lbtnSupplierID" runat="server" Text="SupplierID" CommandName="SupplierID" OnCommand="lbtnSort_Command"></asp:LinkButton><asp:Label ID=&quo
补充:Web开发 , ASP.Net ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,