关于GridView
2016-03-21 10:43
183 查看
//—————————————————新增总结————————————————————
1.GridView的多选效果(注意一个字都不要错才能运行)
(1)先在JavaScript中写代码:
<head runat="server">
<script language="javascript">
function
GetAllCheckBox(CheckAll)
{
var items=document.getElementsByTagName_r("input");
for(i=0;i<items.length;i++)
{
if(items[i].type=="checkbox")
{
items[i].checked=CheckAll.checked;
}
}
}
</script>
<title>无标题页</title>
(2)在控件的onclick事件中写代码(即使控件没有这个事件,也要硬写上去)
<asp:CheckBox ID="chkCheckAll" runat="server"
Text="全选"
onclick="javascript:GetAllCheckBox(this)"/>
2.GridView的光棒效果:——要在它的行绑定事件中写:里面注释的即是。
//GridView的行绑定事件
protected
void GridView1_RowDataBound(object sender, GridViewRowEventArgs
e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (e.Row.RowState == DataControlRowState.Normal || e.Row.RowState
== DataControlRowState.Alternate)
{
//关于多选框
CheckBox box =
(CheckBox)e.Row.Cells[7].FindControl("CboxSelect");
if (MessageManager.IDList != null)
{
if (MessageManager.IDList.Contains( box.Text))
{
box.Checked = true;
}
}
//为GridView添加光棒效果
e.Row.Attributes.Add("onmouseover",
"currentcolor=this.style.backgroundColor;this.style.backgroundColor='#6699ff'");
1.GridView的多选效果(注意一个字都不要错才能运行)
(1)先在JavaScript中写代码:
<head runat="server">
<script language="javascript">
function
GetAllCheckBox(CheckAll)
{
var items=document.getElementsByTagName_r("input");
for(i=0;i<items.length;i++)
{
if(items[i].type=="checkbox")
{
items[i].checked=CheckAll.checked;
}
}
}
</script>
<title>无标题页</title>
(2)在控件的onclick事件中写代码(即使控件没有这个事件,也要硬写上去)
<asp:CheckBox ID="chkCheckAll" runat="server"
Text="全选"
onclick="javascript:GetAllCheckBox(this)"/>
2.GridView的光棒效果:——要在它的行绑定事件中写:里面注释的即是。
//GridView的行绑定事件
protected
void GridView1_RowDataBound(object sender, GridViewRowEventArgs
e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (e.Row.RowState == DataControlRowState.Normal || e.Row.RowState
== DataControlRowState.Alternate)
{
//关于多选框
CheckBox box =
(CheckBox)e.Row.Cells[7].FindControl("CboxSelect");
if (MessageManager.IDList != null)
{
if (MessageManager.IDList.Contains( box.Text))
{
box.Checked = true;
}
}
//为GridView添加光棒效果
e.Row.Attributes.Add("onmouseover",
"currentcolor=this.style.backgroundColor;this.style.backgroundColor='#6699ff'");
相关文章推荐
- 欢迎您在新浪博客安家
- Linux服务器沦陷为肉鸡的全过程实录
- iOS开发调试技巧总结(持续更新中)
- 数据库连接池实现原理
- QuickStart with RHOS(Red Hat OpenStack) Folsom Preview
- 数据类型汇总(java、php、C++)
- Java 中 == 比较的是什么?
- Java排序算法(五)--希尔排序(ShellSort)
- 聚来宝获商务部《媒体购物国家标准》制订单位 【2012-12-22 17:04:20】【来源:京华网】【字体:大 中 小】【颜色:红 绿 蓝 黑】【分享新闻】
- 浙江不老仙妻,教去皱
- 为什么某些网页打不开而别人却能打开?
- mysql_connect()与mysqli_connect()
- 70老太揉三阴嫩如少女!
- 我在CSDN有个新家
- Smarty缓存机制 $smarty->display(
- MySQL concat函数使用方法:(链接字符串,或字段)
- 路径前加于不加(/)反斜杠
- 分享memcache和memcached安装过程
- 利用返利程序做淘宝客需要注意的三个方面
- 罗麦直销