打造最大的网络营销知识与推广的信息化航母

进入论坛 | 会员注册 | 会员登陆 |
首页 >> asp.net >> asp.net常见问题 >> 全选改变背景颜色的问题?正文

全选改变背景颜色的问题?

来源:it我领先 发布时间:2010-03-08               浏览次数:64 进入论坛社区

具体代码如下所示:当我选中其中某一行前面的CheckBox时,这行的背景颜色就改变了,但是当我选择全选框按钮时,每行前面的CheckBox都选中了,但是背景颜色却不改变,请问是怎么回事啊?谢谢!

aspx代码

代码
<%@ Page Language=双引号C#双引号 AutoEventWireup=双引号true双引号  CodeFile=双引号gridcheck.aspx.cs双引号 Inherits=双引号_Default双引号 %>

<!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>
<script type=双引号text/javascript双引号>
function changecolor(cbo,o)
{
var theBox=cbo;
var tr=document.getElementById(o); //o为行的id
if(theBox.checked)
{
tr.style.backgroundColor=双引号Red双引号;
}
else
{
tr.style.backgroundColor=双引号#CCCCCC双引号;

}
}
</script>

</head>
<body>
<form id=双引号form1双引号 runat=双引号server双引号>
<div>
<table style=双引号border:solid 1px green;width:40%双引号>
<tr>
<td style=双引号background-color:Green双引号>
<span style=双引号font-size: 14pt; color: #ffffff双引号><strong>
GridView控件与checkBox控件结合</strong></span></td>
</tr>
<tr>
<td>
<asp:GridView ID=双引号GridView1双引号 Width=双引号100%双引号 runat=双引号server双引号 AutoGenerateColumns=双引号False双引号
CellPadding=双引号3双引号 Font-Size=双引号9pt双引号 BackColor=双引号White双引号 BorderColor=双引号#CCCCCC双引号
BorderStyle=双引号None双引号 BorderWidth=双引号1px双引号 DataKeyNames=双引号stuid双引号
onrowdatabound=双引号GridView1_RowDataBound双引号>
<FooterStyle BackColor=双引号White双引号 ForeColor=双引号#000066双引号 />
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID=双引号CheckBox1双引号 runat=双引号server双引号 />
</ItemTemplate>
<HeaderTemplate>

文章来源:http://it503.com/detail.PHP
添加收藏到:

关键词:全选改变背景颜色的问题?,aspx
联系我们 | 关于我们 | rss订阅 | 网络社区 | 网站帮助 | 网站地图
Copyright(C) 2006-2007 it503 All Rights Reserved
本站如有转载或引用的文章涉及版权问题请速与我们联系 由于将本站资源用于商业用途而引起的纠纷,本站不负任何责任。
冀ICP备07500673号