会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
My Happy Ending,Grip Time Study Hard to be an excellent network engineer,My Happy will start
博客园
首页
新随笔
联系
订阅
管理
CheckBox全选 GridView
无标题页 BorderColor="#999999" BorderStyle="Solid" BorderWidth="1px" CellPadding="3" DataKeyNames="job_id" ForeColor="Black" GridLines="Vertical" Height="72px" PageSize="3" Width="358px
<
html
xmlns
="http://www.w3.org/1999/xhtml"
>
<
head
runat
="server"
>
<
title
>
无标题页
</
title
>
<
script
type
="text/javascript"
>
//
<![CDATA[
function
CheckAll(oCheckbox)
{
var
GridView2
=
document.getElementById(
"
<%=GridView2.ClientID %>
"
);
for
(i
=
1
;i
<
GridView2.rows.length
-
1
; i
++
)
{
GridView2.rows[i].cells[
0
].getElementsByTagName(
"
INPUT
"
)[
0
].checked
=
oCheckbox.checked;
}
}
//
]]>
</
script
>
</
head
>
<
body
>
<
form
id
="form1"
runat
="server"
>
<
div
>
<
asp:GridView
ID
="GridView2"
runat
="server"
AutoGenerateColumns
="False"
BackColor
="White"
BorderColor
="#999999"
BorderStyle
="Solid"
BorderWidth
="1px"
CellPadding
="3"
DataKeyNames
="job_id"
ForeColor
="Black"
GridLines
="Vertical"
Height
="72px"
PageSize
="3"
Width
="358px"
>
<
FooterStyle
BackColor
="#CCCCCC"
/>
<
Columns
>
<
asp:TemplateField
>
<
HeaderTemplate
>
<
asp:CheckBox
ID
="CheckBox1"
runat
="server"
Text
="全选"
onclick
="CheckAll(this)"
/>
</
HeaderTemplate
>
<
ItemTemplate
>
<
asp:CheckBox
ID
="CheckBox2"
runat
="server"
/>
</
ItemTemplate
>
</
asp:TemplateField
>
<
asp:BoundField
DataField
="job_id"
HeaderText
="编号"
/>
<
asp:BoundField
DataField
="job_desc"
HeaderText
="描述信息"
/>
<
asp:BoundField
DataField
="min_lvl"
HeaderText
="最小值"
/>
</
Columns
>
<
SelectedRowStyle
BackColor
="#000099"
Font-Bold
="True"
ForeColor
="White"
/>
<
PagerStyle
BackColor
="#999999"
ForeColor
="Black"
HorizontalAlign
="Center"
/>
<
HeaderStyle
BackColor
="Black"
Font-Bold
="True"
ForeColor
="White"
/>
<
AlternatingRowStyle
BackColor
="#CCCCCC"
/>
</
asp:GridView
>
</
div
>
</
form
>
</
body
>
</
html
>
posted on
2008-03-31 10:42
小角色
阅读(
182
) 评论(
0
)
收藏
举报
刷新页面
返回顶部