网络编程 | 站长之家 | 网页制作 | 图形图象 | 操作系统 | 冲浪宝典 | 软件教学 | 网络办公 | 邮件系统 | 网络安全 | 认证考试 | 系统进程
Firefox | IE | Maxthon | 迅雷 | 电驴 | BitComet | FlashGet | QQ | QQ空间 | Vista | 输入法 | Ghost | Word | Excel | wps | Powerpoint
asp | .net | php | jsp | Sql | c# | Ajax | xml | Dreamweaver | FrontPages | Javascript | css | photoshop | fireworks | Flash | Cad | Discuz!
当前位置 > 网站建设学院 > 网络编程 > ASP.NET技巧
Tag:注入,存储过程,分页,安全,优化,xmlhttp,fso,jmail,application,session,防盗链,stream,无组件,组件,md5,乱码,缓存,加密,验证码,算法,cookies,ubb,正则表达式,水印,索引,日志,压缩,base64,url重写,上传,控件,Web.config,JDBC,函数,内存,PDF,迁移,结构,破解,编译,配置,进程,分词,IIS,Apache,Tomcat,phpmyadmin,Gzip,触发器,socket
网络编程:ASP教程,ASP.NET教程,PHP教程,JSP教程,C#教程,数据库,XML教程,Ajax,Java,Perl,Shell,VB教程,Delphi,C/C++教程,软件工程,J2EE/J2ME,移动开发
本月文章推荐
.ASP.NET中使用Apache log4net .
.Asp.Net下通过切换CSS换皮肤.
.部署ASP.NET(包含.net framework.
.借助WebService实现多线程上传文.
.ASP.NET中在线用户统计的简单实现.
.在ASP.NET中访问SQL 2005报表服务 .
.在Java和.NET平台的加密术比较.
.安装好.net之后如何运行asp.net程.
.如何在删除并重新安装 IIS 之后修.
.ASP.NET中如何防范SQL注入式攻击.
.ASP.NET中实现模版的动态加载.
.关于asp.net c#中对cookie的操作.
.数据绑定控件再ASP.NET1.X和ASP..
.ADO.NET 2.0 - 如何建立一个 Da.
.在虚拟主机上用asp.net轻松实现u.
.深入理解 ViewState.
.asp.net页面head区动态设置全攻略.
.使用WebClient自动填写并提交ASP.
.ASP.NET中水晶报表的使用.
.用JS脚本实现CheckBoxList只能选.

ASP.NET2.0下为GridView添加鼠标滑过(onmouseover、onmouseout)的行颜色高亮效果!

发表日期:2006-7-19


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';");
        }
上一篇:ASP.NET2.0服务器控件之捕获回传事件 人气:6054
下一篇:ASP.NET2.0下为GridView添加服务器端删除确认! 人气:7440
浏览全部GridView的内容 Dreamweaver插件下载 网页广告代码 祝你圣诞节快乐 2009年新年快乐