GridView的行颜色高亮显示(包括满足条件的行)
来源:互联网 发布:网络电视盒的安装方法 编辑:程序博客网 时间:2024/05/21 07:58
GridView的行颜色高亮显示(包括满足条件的行)
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
//将满足特定条件的行标为高亮
if (e.Row.RowType == DataControlRowType.DataRow)//判定当前的行是否属于datarow类型的行
{
int money = Convert.ToInt32(DataBinder.Eval(e.Row.DataItem, "MONEY"));//取当前行的列值
if (money == 77)
e.Row.BackColor = Color.Red;
//string customer = (string)DataBinder.Eval(e.Row.DataItem, "CUSTOMER");
string customer = DataBinder.Eval(e.Row.DataItem, "CUSTOMER").ToString();
if (customer == "sdf")
e.Row.BackColor = Color.Red;
}
//加入鼠标滑过的高亮效果
if (e.Row.RowType == DataControlRowType.DataRow)//判定当前的行是否属于datarow类型的行
{
//当鼠标放上去的时候 先保存当前行的背景颜色 并给附一颜色
e.Row.Attributes.Add("onmouseover", "currentcolor=this.style.backgroundColor;this.style.backgroundColor='yellow',this.style.fontWeight='';");
//当鼠标离开的时候 将背景颜色还原的以前的颜色
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=currentcolor,this.style.fontWeight='';");
}
//单击行改变行背景颜色
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onclick","this.style.backgroundColor='#99cc00'; this.style.color='buttontext';this.style.cursor='default';");
}
{
//将满足特定条件的行标为高亮
if (e.Row.RowType == DataControlRowType.DataRow)//判定当前的行是否属于datarow类型的行
{
int money = Convert.ToInt32(DataBinder.Eval(e.Row.DataItem, "MONEY"));//取当前行的列值
if (money == 77)
e.Row.BackColor = Color.Red;
//string customer = (string)DataBinder.Eval(e.Row.DataItem, "CUSTOMER");
string customer = DataBinder.Eval(e.Row.DataItem, "CUSTOMER").ToString();
if (customer == "sdf")
e.Row.BackColor = Color.Red;
}
//加入鼠标滑过的高亮效果
if (e.Row.RowType == DataControlRowType.DataRow)//判定当前的行是否属于datarow类型的行
{
//当鼠标放上去的时候 先保存当前行的背景颜色 并给附一颜色
e.Row.Attributes.Add("onmouseover", "currentcolor=this.style.backgroundColor;this.style.backgroundColor='yellow',this.style.fontWeight='';");
//当鼠标离开的时候 将背景颜色还原的以前的颜色
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=currentcolor,this.style.fontWeight='';");
}
//单击行改变行背景颜色
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onclick","this.style.backgroundColor='#99cc00'; this.style.color='buttontext';this.style.cursor='default';");
}
0 0
- GridView的行颜色高亮显示(包括满足条件的行)
- Gridview相关颜色显示(满足特定数据要求的颜色显示,高亮显示)
- 在GridView中,不同条件的行显示不同的颜色
- 在GridView中,不同条件的行显示不同的颜色
- 怎样使GridView中满足某个条件的行可编辑,其余行不可编辑?
- C#开发学习笔记:GridView中如何设置满足条件的行不可编辑(XtraGrid)
- 在gridcontrol中怎样设置满足特定条件的行的颜色等风格
- 在gridcontrol中怎样设置满足特定条件的行的颜色等风格
- 在gridcontrol中设置满足特定条件的行的颜色等风格
- 自用的 .vimrc 满足高亮、代码颜色、缩进等
- GridView 合并单元格(多列)及特定条件的数据高亮显示实现
- GridView 合并单元格(多列)及特定条件的数据高亮显示实现
- table选中的行以指定颜色高亮显示
- 【DEV GridControl】怎样使GridView中满足某个条件的行可编辑,其余行不可编辑?
- [devexpress相关控件]在gridcontrol中怎样设置满足特定条件的行的颜色等风格
- 给DataGrid中满足条件的超链接列加颜色
- Flex datagrid/advancedatagrid按条件显示行的背景颜色
- Flex datagrid/advancedatagrid按条件显示行的背景颜色
- IIS7配置PHP图解
- onMouseEnter 和onMouseOver区别以及跨浏览器解决策略
- linux的ulimit各种限制之深入分析
- android开发教程关于使用java concurrent处理并发需求
- scons makefile比较
- GridView的行颜色高亮显示(包括满足条件的行)
- Beacon Mountain 测试版 – 常见问题解答
- SWT背景图片透明色变黑,边框问题
- Android Toast.makeText().show()无法正常显示
- VC读取和写入配置文件
- NSLocalizedString(二)
- SharePoint Server 2013开发之旅(四):配置工作流开发和测试环境
- struts2 从一个action 跳转到另一个action的两种方法
- Eclipse EasyExplorer打开文件夹的插件