zoukankan
html css js c++ java
DataGrid 完全攻略之三(实现删除全选或者全不选)
前台代码:html
<%
@ Page language
=
"
c#
"
Codebehind
=
"
SelAndDropAll.aspx.cs
"
AutoEventWireup
=
"
false
"
Inherits
=
"
MsDataGrid.SelAndDropAll
"
%>
<!
DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
>
<
HTML
>
<
HEAD
>
<
title
>
DataGrid使用举例
</
title
>
<
meta
name
="GENERATOR"
Content
="Microsoft Visual Studio 7.0"
>
<
meta
name
="CODE_LANGUAGE"
Content
="C#"
>
<
meta
name
="vs_defaultClientScript"
content
="JavaScript"
>
<
meta
name
="vs_targetSchema"
content
="http://schemas.microsoft.com/intellisense/ie5"
>
</
HEAD
>
<
body
MS_POSITIONING
="GridLayout"
>
<
form
id
="Form1"
method
="post"
runat
="server"
>
<
FONT
face
="宋体"
>
<
asp:DataGrid
id
="dgShow"
style
="Z-INDEX: 101; LEFT: 31px; POSITION: absolute; TOP: 93px"
runat
="server"
Width
="842px"
Height
="172px"
BorderColor
="Tan"
BorderWidth
="1px"
BackColor
="LightGoldenrodYellow"
CellPadding
="2"
GridLines
="None"
ForeColor
="Black"
PageSize
="1"
AutoGenerateColumns
="False"
>
<
SelectedItemStyle
ForeColor
="GhostWhite"
BackColor
="DarkSlateBlue"
></
SelectedItemStyle
>
<
AlternatingItemStyle
BackColor
="PaleGoldenrod"
></
AlternatingItemStyle
>
<
HeaderStyle
Font-Bold
="True"
BackColor
="Tan"
></
HeaderStyle
>
<
FooterStyle
BackColor
="Tan"
></
FooterStyle
>
<
Columns
>
<
asp:BoundColumn
DataField
="StudentID"
ReadOnly
="True"
HeaderText
="学生ID"
></
asp:BoundColumn
>
<
asp:BoundColumn
DataField
="StudentName"
HeaderText
="学生姓名"
></
asp:BoundColumn
>
<
asp:BoundColumn
DataField
="StudentPass"
HeaderText
="密码"
></
asp:BoundColumn
>
<
asp:BoundColumn
DataField
="Sex"
HeaderText
="性别"
></
asp:BoundColumn
>
<
asp:BoundColumn
DataField
="Birthday"
HeaderText
="生日"
DataFormatString
="{0:yyyy-M-d}"
></
asp:BoundColumn
>
<
asp:BoundColumn
DataField
="Email"
HeaderText
="邮件地址"
></
asp:BoundColumn
>
<
asp:EditCommandColumn
ButtonType
="LinkButton"
UpdateText
="更新"
HeaderText
="操作"
CancelText
="取消"
EditText
="编辑"
></
asp:EditCommandColumn
>
<
asp:ButtonColumn
Text
="删除"
HeaderText
="删除"
CommandName
="Delete"
></
asp:ButtonColumn
>
<
asp:TemplateColumn
HeaderText
="选择"
>
<
HeaderTemplate
>
<
asp:CheckBox
id
="cbAll"
runat
="server"
OnCheckedChanged
="CheckAll"
Text
="全选"
AutoPostBack
="True"
></
asp:CheckBox
>
</
HeaderTemplate
>
<
ItemTemplate
>
<
asp:CheckBox
id
="cbSelect"
runat
="server"
AutoPostBack
="True"
></
asp:CheckBox
>
</
ItemTemplate
>
</
asp:TemplateColumn
>
</
Columns
>
<
PagerStyle
HorizontalAlign
="Center"
ForeColor
="DarkSlateBlue"
BackColor
="PaleGoldenrod"
></
PagerStyle
>
</
asp:DataGrid
>
<
asp:Button
id
="btnDelete"
style
="Z-INDEX: 102; LEFT: 34px; POSITION: absolute; TOP: 47px"
runat
="server"
Text
="删除"
></
asp:Button
></
FONT
>
</
form
>
</
body
>
</
HTML
>
后台代码:cs
<%
@ Page language
=
"
c#
"
Codebehind
=
"
SelAndDropAll.aspx.cs
"
AutoEventWireup
=
"
false
"
Inherits
=
"
MsDataGrid.SelAndDropAll
"
%>
<!
DOCTYPE HTML PUBLIC
"
-//W3C//DTD HTML 4.0 Transitional//EN
"
>
<
HTML
>
<
HEAD
>
<
title
>
DataGrid使用举例
</
title
>
<
meta name
=
"
GENERATOR
"
Content
=
"
Microsoft Visual Studio 7.0
"
>
<
meta name
=
"
CODE_LANGUAGE
"
Content
=
"
C#
"
>
<
meta name
=
"
vs_defaultClientScript
"
content
=
"
JavaScript
"
>
<
meta name
=
"
vs_targetSchema
"
content
=
"
http://schemas.microsoft.com/intellisense/ie5
"
>
</
HEAD
>
<
body MS_POSITIONING
=
"
GridLayout
"
>
<
form id
=
"
Form1
"
method
=
"
post
"
runat
=
"
server
"
>
<
FONT face
=
"
宋体
"
>
<
asp:DataGrid id
=
"
dgShow
"
style
=
"
Z-INDEX: 101; LEFT: 31px; POSITION: absolute; TOP: 93px
"
runat
=
"
server
"
Width
=
"
842px
"
Height
=
"
172px
"
BorderColor
=
"
Tan
"
BorderWidth
=
"
1px
"
BackColor
=
"
LightGoldenrodYellow
"
CellPadding
=
"
2
"
GridLines
=
"
None
"
ForeColor
=
"
Black
"
PageSize
=
"
1
"
AutoGenerateColumns
=
"
False
"
>
<
SelectedItemStyle ForeColor
=
"
GhostWhite
"
BackColor
=
"
DarkSlateBlue
"
></
SelectedItemStyle
>
<
AlternatingItemStyle BackColor
=
"
PaleGoldenrod
"
></
AlternatingItemStyle
>
<
HeaderStyle Font
-
Bold
=
"
True
"
BackColor
=
"
Tan
"
></
HeaderStyle
>
<
FooterStyle BackColor
=
"
Tan
"
></
FooterStyle
>
<
Columns
>
<
asp:BoundColumn DataField
=
"
StudentID
"
ReadOnly
=
"
True
"
HeaderText
=
"
学生ID
"
></
asp:BoundColumn
>
<
asp:BoundColumn DataField
=
"
StudentName
"
HeaderText
=
"
学生姓名
"
></
asp:BoundColumn
>
<
asp:BoundColumn DataField
=
"
StudentPass
"
HeaderText
=
"
密码
"
></
asp:BoundColumn
>
<
asp:BoundColumn DataField
=
"
Sex
"
HeaderText
=
"
性别
"
></
asp:BoundColumn
>
<
asp:BoundColumn DataField
=
"
Birthday
"
HeaderText
=
"
生日
"
DataFormatString
=
"
{0:yyyy-M-d}
"
></
asp:BoundColumn
>
<
asp:BoundColumn DataField
=
"
Email
"
HeaderText
=
"
邮件地址
"
></
asp:BoundColumn
>
<
asp:EditCommandColumn ButtonType
=
"
LinkButton
"
UpdateText
=
"
更新
"
HeaderText
=
"
操作
"
CancelText
=
"
取消
"
EditText
=
"
编辑
"
></
asp:EditCommandColumn
>
<
asp:ButtonColumn Text
=
"
删除
"
HeaderText
=
"
删除
"
CommandName
=
"
Delete
"
></
asp:ButtonColumn
>
<
asp:TemplateColumn HeaderText
=
"
选择
"
>
<
HeaderTemplate
>
<
asp:CheckBox id
=
"
cbAll
"
runat
=
"
server
"
OnCheckedChanged
=
"
CheckAll
"
Text
=
"
全选
"
AutoPostBack
=
"
True
"
></
asp:CheckBox
>
</
HeaderTemplate
>
<
ItemTemplate
>
<
asp:CheckBox id
=
"
cbSelect
"
runat
=
"
server
"
AutoPostBack
=
"
True
"
></
asp:CheckBox
>
</
ItemTemplate
>
</
asp:TemplateColumn
>
</
Columns
>
<
PagerStyle HorizontalAlign
=
"
Center
"
ForeColor
=
"
DarkSlateBlue
"
BackColor
=
"
PaleGoldenrod
"
></
PagerStyle
>
</
asp:DataGrid
>
<
asp:Button id
=
"
btnDelete
"
style
=
"
Z-INDEX: 102; LEFT: 34px; POSITION: absolute; TOP: 47px
"
runat
=
"
server
"
Text
=
"
删除
"
></
asp:Button
></
FONT
>
</
form
>
</
body
>
</
HTML
>
查看全文
相关阅读:
2.2阶乘末尾0的个数,最低位1的位置
samba服务器使用
全排列的非递归算法
2.1二进制数中1的个数
2.3发帖水王
C #与##的使用
NEU1141the unique number
【转】4习惯让你越休息越累
二叉树由先序遍历和中序遍历输出后序遍历
UVA100
原文地址:https://www.cnblogs.com/ghd258/p/253185.html
最新文章
中文字符串分隔的注意问题
[Linux命令] 查看目录大小du
dos格式转unix格式
命令集锦
zip打包是去掉路径
JS验证中文姓名,手机号
jQuery获取动态操作iframe
第一篇博客园随笔
C#/C++/Fortran 在32位/64位下数学计算性能对比
HTML入门学习 HTML基础知识
热门文章
Win7 下安装Win8到U盘移动硬盘的方法 Windows To Go
HTML入门学习 HTML5 视频与音频
编辑嵌入字体的PDF文件
SATA硬盘热插拔设置
打造不死系统利用VHD将Win7安装到文件,以及父子系统
Linux连接Linux远程桌面VNC
查看变量的类型名C++
C++读取配置文件
字符串编辑距离
全排列递归算法
Copyright © 2011-2022 走看看