国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

ASP.NET2.0下為GridView添加鼠標滑過(onmouseover、onmouseout)的行顏色高亮效果!

2019-11-18 17:06:10
字體:
來源:轉載
供稿:網友
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';");
        }
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 灵武市| 双辽市| 华蓥市| 铜山县| 桂东县| 镇雄县| 华安县| 云林县| 麻城市| 永顺县| 永安市| 台前县| 仙桃市| 繁昌县| 宝丰县| 鄱阳县| 六安市| 平和县| 万安县| 宁波市| 柏乡县| 远安县| 泌阳县| 繁昌县| 东源县| 承德县| 平潭县| 竹溪县| 南通市| 巴南区| 三河市| 公安县| 涟水县| 耿马| 西和县| 蓝田县| 南平市| 永胜县| 宝坻区| 湛江市| 迁西县|