zoukankan      html  css  js  c++  java
  • GridView单击行

    1.使用GridView提示选择到的行,可选择多行

    问题? 怎么样才能单击此行,其它的以前选择行取消选择状态呢。

    步骤1.给GridView的创建RowCreated事件。具体代码如下:  protected void gv_typelist_RowCreated(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            { 
              e.Row.Attributes.Add("id", "row" + e.Row.RowIndex);
            e.Row.Attributes.Add("onclick", "ChangeRowColor('row"+e.Row.RowIndex+"')");
            }
        }

    在.aspx页面写入JS:代码如下:<script language ="javascript" type="text/javascript">
    var oldColor = '';
    function ChangeRowColor(rowID)
    {  
    var color=document.getElementById(rowID).style.color;
      if(color!='buttontext') 
      oldColor="buttontext";
      if(color=='buttontext')
      document.getElementById(rowID).style.color='' ;
      else
      document.getElementById(rowID).style.color='buttontext' ;
    }

    </script>

    上进,务实
  • 相关阅读:
    接口(interface)的使用于注意事项
    构造方法
    MySQL数据库软件
    final与static的作用
    区分like和in
    list,set,map各有什么异同?
    简述 Overload 与 Override
    标识符的基础知识
    类的继承关系
    MySQL常见索引失效
  • 原文地址:https://www.cnblogs.com/gaonengquan/p/1351736.html
Copyright © 2011-2022 走看看