⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 新建 文本文档 (5).txt

📁 使用javascript实现datagrid的复选框全选的功能。
💻 TXT
字号:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Refer_Del.aspx.cs" Inherits="Admin_Refer_Del" %>

<!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="../css/allcss.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript">
<!--
function SelAll()
{
 var RowCnt=<%=RowCount%>;
 var isCheck;
 isCheck=document.all.CheckAll.checked;
 for(i=0;i<RowCnt+1;i++)
 { 
    if(typeof(document.all.DbGrid.rows(i).cells(0).children(0))=="object")
    {
       document.all.DbGrid.rows(i).cells(0).children(0).checked=isCheck; 
    }
 }
}
// -->
</script>
</head>
<body>
    <form id="form1" runat="server">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="7" valign="top" background="images/t4.gif"><img src="images/t1.gif" width="7" height="23" /></td>
    <td width="100%" align="center" background="images/t2.gif" class="bt">已删除咨询列表</td>
    <td width="5" align="right" valign="top" background="images/t6.gif"><img src="images/t3.gif" width="5" height="23" /></td>
  </tr>
<tr>
<td align=center colspan=3>
  <asp:DataGrid ID="DbGrid" runat="server" Width="100%" border="1" align="center" cellpadding="1" bordercolorlight="#EFBA5A" bordercolordark="#FFFFFF" bgcolor="#FFFFFF" AutoGenerateColumns="False" BorderColor="#EFBA5A" BorderStyle="Double" AllowPaging="True">
      <AlternatingItemStyle BackColor="#FFFBEF" BorderColor="#EFBA5A" BorderStyle="Solid" />
      <HeaderStyle BackColor="#FFFBEF" />
      <Columns>
          <asp:TemplateColumn HeaderText="全&lt;input type=checkbox id=CheckAll onclick='javascript:SelAll()'&gt;选">
           <ItemStyle Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" HorizontalAlign="Center" />
              <ItemTemplate>
                  <asp:CheckBox ID="chkExport" runat="server" />
              </ItemTemplate>
          </asp:TemplateColumn>
          <asp:TemplateColumn Visible="False">
              <ItemTemplate>
                  <asp:Label ID="LabelID" runat="server" Text='<%# DataBinder.Eval(Container,"DataItem.ID") %>'></asp:Label>
              </ItemTemplate>
          </asp:TemplateColumn>
          <asp:TemplateColumn HeaderText="咨询问题">
              <ItemTemplate>
                  <a href="#" onclick="window.open('Question_Show.aspx?ID=<%# DataBinder.Eval(Container,"DataItem.ID") %>','applWin','top=60px,width=600px,height=500px,left=200px')"><%# DataBinder.Eval(Container,"DataItem.Title") %></a>
              </ItemTemplate>
          </asp:TemplateColumn>
          <asp:BoundColumn DataField="Author" HeaderText="姓名"></asp:BoundColumn>
          <asp:BoundColumn DataField="Date" HeaderText="咨询日期" DataFormatString="{0:yyyy-MM-dd}"></asp:BoundColumn>
          <asp:BoundColumn DataField="DelName" HeaderText="操作人"></asp:BoundColumn>
          <asp:BoundColumn DataField="DelDate" DataFormatString="{0:yyyy-MM-dd}" HeaderText="操作日期">
          </asp:BoundColumn>
      </Columns>
      <PagerStyle Mode="NumericPages" PageButtonCount="5" Visible="False" />
  </asp:DataGrid></td>
</tr>

 
</table>
<table width="98%" border="1" align="center" cellpadding="1" cellspacing="0" bordercolorlight="#EFBA5A" bordercolordark="#FFFFFF" bgcolor="#FFFFFF">
  <tr>
             <td align="right" width="60%">
    <asp:Label ID="Message" runat="server"></asp:Label>共<%=DbGrid.PageCount%>页&nbsp; 
                 <asp:LinkButton ID="PageUp" runat="server" OnClick="DropDownList_Page_SelectedIndexChanged">上一页</asp:LinkButton>
                 &nbsp; &nbsp; 
                 <asp:LinkButton ID="PageDown" runat="server" OnClick="DropDownList_Page_SelectedIndexChanged">下一页</asp:LinkButton>
                 &nbsp; &nbsp;
                 <asp:DropDownList ID="DropDownList_Page" runat="server" Width="44px" AutoPostBack="True" OnSelectedIndexChanged="DropDownList_Page_SelectedIndexChanged">
                 </asp:DropDownList></td>
        </tr>
          <tr>
    <td height="30" colspan="4" align="center" bgcolor="#FFFFFF">
        <asp:Button ID="ButtonDel" runat="server" Text="清除" Width="70px"  CssClass="an2" OnClick="ButtonDel_Click"/>
        </td>
  </tr>
</table>
    </form>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -