亚洲免费乱码视频,日韩 欧美 国产 动漫 一区,97在线观看免费视频播国产,中文字幕亚洲图片

      1. <legend id="ppnor"></legend>

      2. 
        
        <sup id="ppnor"><input id="ppnor"></input></sup>
        <s id="ppnor"></s>

        gridview 行選添加顏色和事件

        字號(hào):


            在gridview 列表中,需要添加如下效果,如果經(jīng)過(guò)時(shí)變色,移開(kāi)時(shí)還原成以前的顏色,行選中時(shí)通過(guò)加深色,從而知道選中了哪行
            在gridview 列表中,需要添加如下效果,如果經(jīng)過(guò)時(shí)變色,移開(kāi)時(shí)還原成以前的顏色,行選中時(shí)通過(guò)加深色,從而知道選中了哪行,特別是列表數(shù)據(jù)比較多的時(shí)候,標(biāo)志很重要,同時(shí)觸發(fā)選中行事件,那么如何 行選中加顏色,同時(shí)也出發(fā)我們事件了?如果我們通入 e.row.attributes.add(onclick, 綁定兩次,發(fā)現(xiàn)只能觸發(fā)其中的一個(gè),其實(shí)可以把另個(gè)放到一個(gè)里面
            下面是具體的例子:
            代碼如下:
            protected void editgridview_rowdatabound(object sender, gridviewroweventargs e)
            {
            if (e.row.rowtype== datacontrolrowtype.datarow)
            {
            //當(dāng)鼠標(biāo)放上去的時(shí)候 先保存當(dāng)前行的背景顏色 并給附一顏色
            e.row.attributes.add(onmouseover, currentcolor=this.style.backgroundcolor;this.style.backgroundcolor='inactivecaptiontext',this.style.fontweight
            ='';this.style.cursor='hand';);
            //當(dāng)鼠標(biāo)離開(kāi)的時(shí)候 將背景顏色還原的以前的顏色
            e.row.attributes.add(onmouseout, this.style.backgroundcolor=currentcolor,this.style.fontweight='';);
            //當(dāng)鼠標(biāo)單擊時(shí),加深色標(biāo)志
            e.row.attributes.add(onclick, setvalue();if(window.oldtr!=null){window.oldtr.runtimestyle.csstext='';}this.runtimestyle.csstext='background-color:#e6c5fc';window.oldtr=this);
            }
            }
            js代碼:
            代碼如下:
            <script type=text/javascript >
            function setvalue() {
            alert('行單擊事件,同時(shí)變色');
            }
            </script>