Gridview 行变色和行按钮调用前端js
2024-08-24 21:07:09
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>
最新文章
- Gulp探究折腾之路(I)
- ES6 - Note7:Generator函数
- VM环境下,快速复制多个SQLServer实例,环境调整
- poj 1125 (floyd)
- 【iCore3 双核心板】例程三十一:HTTP_IAP_FPGA实验——更新升级FPGA
- python成长之路【第四篇】:装饰器
- 页面加载后resize页面布局
- Javascript获取地址栏参数值
- jsonp跨域请求学习笔记
- Spring整合Shiro做权限控制模块详细案例分析
- [Android学习笔记]继承自ViewGroup的控件的过程学习
- linux内核内存管理(zone_dma zone_normal zone_highmem)
- 第13章 Swing程序设计----JDialog窗体
- mha 复制检查报错“There is no alive server. We can&#39;t do failover”
- Android中常用开发工具类—持续更新...
- OUTLOOK2019 解决 无法验证您连接到的服务器使用的安全证书
- python属性查找 深入理解(attribute lookup)
- 在 Visual Studio 生成项目时,会发现一些 dll 并没有被复制到输出目录,导致最终程序的执行错误
- 大数据项目(MTDAP)随想
- tcpdump使用方法总结
热门文章
- C++学习42 输入和输出的概念
- IOS中类似的。9.png图片
- Linux平台块设备到字符设备(裸设备)的三种映射方式(转载)
- 菜鸟-手把手教你把Acegi应用到实际项目中(8)-扩展UserDetailsService接口
- Codeforces Round #218 (Div. 2) C. Hamburgers
- WebsitePanel 2.1.0beta配置部分
- 操作系统学习笔记 对称多处理(SMP)
- jquery递归遍历xml文件,形成ul-li序列,生成树结构(使用了treeview插件)
- CLRS:max_heap and min_heap operation (pseudocode)
- AX 获得当前Grid的数据源的记录行数