国产探花免费观看_亚洲丰满少妇自慰呻吟_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';");
        }
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 西畴县| 阜新| 册亨县| 晋中市| 息烽县| 河北省| 闻喜县| 海淀区| 新建县| 筠连县| 黔东| 图木舒克市| 小金县| 兰坪| 柳州市| 龙里县| 保靖县| 临朐县| 互助| 鹤壁市| 逊克县| 秦安县| 惠水县| 钦州市| 大洼县| 呈贡县| 洛浦县| 霍州市| 沛县| 聊城市| 布拖县| 工布江达县| 金川县| 临朐县| 栾城县| 辽源市| 牟定县| 津市市| 罗江县| 合水县| 淅川县|