zoukankan      html  css  js  c++  java
  • GridView显示数据鼠标悬停变色

     一、 首先在前台GridView中加上onrowdatabound="GridView1_RowDataBound":

      <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
                            onrowdatabound="GridView1_RowDataBound">

       .......

     </asp:GridView>

    二、然后在后台的GridView1_RowDataBound事件中写

     protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
            {
                if (e.Row.RowType == DataControlRowType.DataRow)
                {


                    e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#99FFCC'");     //鼠标悬停变色
                  
                    e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");      //鼠标移走颜色还原
                }
            }

  • 相关阅读:
    Sherlock and Squares
    [leetcode] Super Ugly Number
    [leetcode] Ugly Number II
    [leetcode] Ugly Number
    [leetcode] Burst Balloons
    菜根谭#268
    菜根谭#267
    菜根谭#266
    菜根谭#265
    菜根谭#264
  • 原文地址:https://www.cnblogs.com/gcczhongduan/p/3989097.html
Copyright © 2011-2022 走看看