首页 > 编程 > .NET > 正文

ASP.Net 之Datalist删除功能详解附代码

2024-07-10 12:45:11
字体:
来源:转载
供稿:网友

.aspx界面

代码如下:
<html xmlns="http://www.w3.org/1999/xhtml">
 <head runat="server">
     <title>DataList控件删除操作(支持批量删除)</title>
     <script type="text/javascript">
         function CheckAll(Obj) {
             var AllObj = document.all;
             if (Obj.checked)//全选
             {
                 for (var i = 0; i < AllObj.length; i++) {
                     if (AllObj[i].type == "checkbox") {
                         AllObj[i].checked = true;
                     }
                 }
             }
             else//反选
             {
                 for (var i = 0; i < AllObj.length; i++) {
                     if (AllObj[i].type == "checkbox") {
                         AllObj[i].checked = false;
                     }
                 }
             }
         }

     </script>
 </head>
 <body>
     <form id="form1" runat="server">
     <div>
     <fieldset style="text-align: center; width: 540px;">
     <legend style=" text-align:center; ">使用Datalist删除数据(支持批量删除)</legend>

        <asp:DataList ID="DataList1" runat="server"
             onitemcommand="DataList1_ItemCommand" DataKeyField="id">

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表