1.鼠标移动某一行 ,变色

protected void GridView_RowDataBound(object sender, GridViewRowEventArgs e)

    {

    if (e.Row.RowType == DataControlRowType.DataRow)

    {

    //鼠标经过时,行背景色变

    e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='#00A9FF'");

    //鼠标移出时,行背景色变

    e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='#FFFFFF'");
  //设置悬浮鼠标指针形状为“下手”
    e.Row.Attributes["style"] = "cursor:pointer";
} }

2.编辑按钮调用前端的js 方法

 protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
//获取gridview里的编辑按钮
ImageButton buttonE = new ImageButton();
buttonE = (ImageButton)e.Row.FindControl("IB_Edit"); if (e.Row.RowType == DataControlRowType.DataRow)
{
        
DataRowView drv = (DataRowView)e.Row.DataItem; string SYSID_Floor = drv["SYSID_Meter"].ToString();
          //给按钮添加onclick属性,调用前端的js方法 updateNav()
buttonE.Attributes["onclick"] = "return UpdateNav(" + SYSID_Floor + ")";
buttonE.CommandName = "Edit";
}
}

前端js

<script>

 function UpdateNav(floorId) {

            //iframe层-父子操作
var index = layer.open({
title: "修改接表点信息",
type: 2,
area: ['700px', '530px'],
fix: false, //不固定
maxmin: true,
content: "ad_meter_detail.aspx?SYSID=" + floorId
});
//重新给指定层设定width、top等
layer.style(index, {
top: '15px'
});
return false; }
</script>

Gridview 行变色和行按钮调用前端js的更多相关文章

  1. CEF C++调用前端js方法展示传递过来的图片数据

    转载:https://blog.csdn.net/lengyuezuixue/article/details/79769103 在项目开发过程中遇到一个需求,通过C++调用js方法传参给前端显示图片, ...

  2. C#winform中使用Cef的ChromiumWebBrowser内嵌谷歌内核,调用前端js方法

    1.在winform中调用js方法: --调js中的方法无 入参形式 webBrowser1.ExecuteJavascript("logout()"); --调js中的方法给js ...

  3. 后台调用前端JS

    ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script> ...

  4. C#后端调用前端的方法

    在我实际开发过程中,刚好遇到c#后端要调用前端js中的方法,所以研究了一下,特分享如下: 前端代码: <%@ Page Language="C#" AutoEventWire ...

  5. GridView 显示行号 设置行号列的宽度

    /// <summary> /// GridView 显示行号 设置行号列的宽度 /// </summary> /// <param name="gv" ...

  6. Android之GridView控制显示多少行以及遇到的怪事

    前段时间接到一个需求,要求GridView超过两行只显示两行多余的不显示.但是GridView没有设置多少行的api,只有设置多少列的方法,到处查找资料都类似的case,stakeoverfrow上面 ...

  7. jQuery实现表格隔行换色且感应鼠标高亮行变色

    jQuery插件实现表格隔行换色且感应鼠标高亮行变色 http://www.jb51.net/article/41568.htm jquery 操作DOM的基本用法分享http://www.jb51. ...

  8. DOM操作--表格点击行变色

    点击表格行变色,这种网页效果应该还是比较常见的.大家应该看见了,我这里的效果是用DOM操作实现的,那么很多人会问什么是DOM操作,贴出代码之前我就和大家解释一下什么是DOM操作: DOM是Docume ...

  9. Gridview中奇偶数行颜色设置

    在gridview中的RowDataBound事件里面写 switch (e.Row.RowType) {case DataControlRowType.Header: e.Row.BackColor ...

随机推荐

  1. [ActionScript 3.0] AS3调用百度天气预报查询API

    接口说明 根据经纬度/城市名查询天气的结果 接口示例 http://api.map.baidu.com/telematics/v3/weather?location=成都&output=jso ...

  2. ADO.NET 实体框架 资料收集

    https://msdn.microsoft.com/en-us/data/aa937723.aspx https://msdn.microsoft.com/en-us/library/bb39957 ...

  3. java 宠物商店代码

    Pet.java interface Pet{ public String getName(); public String getColor(); public int getAge(); publ ...

  4. String Format for DateTime

    This example shows how to format DateTime using String.Format method. All formatting can be done als ...

  5. poj 3295 Tautology

    点击打开链接 Tautology Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 8127   Accepted: 3115 ...

  6. Nginx作为静态内容服务器(Windows环境)

    1.简单安装 1)下载 http://nginx.org/en/download.html 2)解压后的路径 E:\Study\nginx\nginx-1.7.6 3)执行nginx.exe,访问ht ...

  7. sizeof usage & big / little endian

    http://blog.csdn.net/w57w57w57/article/details/6626840 http://people.cs.umass.edu/~verts/cs32/endian ...

  8. PHP 文件读取 fread、fgets、fgetc、file_get_contents 与 file 函数

    fread().fgets().fgetc().file_get_contents() 与 file() 函数用于从文件中读取内容. fread() fread() 函数用于读取文件(可安全用于二进制 ...

  9. Proxy模式

    本文完整翻译自http://giorgiosironi.blogspot.com/2010/02/practical-php-patterns-proxy.html 因为搜到网上很多这个文章,最后的代 ...

  10. Linux 串口使用

    1. 安装串口调试工具minicom sudo apt-get install minicom 2. 查看串口端口 cfm@cfm880:~$ dmesg | grep tty[ 0.000000] ...