原文发布时间为:2009-04-14 —— 来源于本人的百度文章 [由搬家工具导入]

可这样,在GridView的RowDataBound输入代码,假如id在第0列,且不是摸板列:

C# code
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e){ if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Attributes.Add("style", "cursor: hand;");//将光标设为手形 e.Row.Attributes.Add("onclick", "ItemOver(this," + e.Row.Cells[0].Text + ")"); }}

js代码:

JScript code
<script language="javascript" type="text/javascript"> if (!objbeforeItem) { var objbeforeItem=null; var objbeforeItembackgroundColor=null; } function ItemOver(obj,id) { if(objbeforeItem) { objbeforeItem.style.backgroundColor = objbeforeItembackgroundColor; } objbeforeItembackgroundColor = obj.style.backgroundColor; objbeforeItem = obj; obj.style.backgroundColor = "#FFFF00"; window.open("default1.aspx?id="+id); }</script>

给gridview增加行链接,点击行任意位置进行跳转的更多相关文章

  1. Android点击其他任意位置收起软键盘

    在Android应用开发中,经常出现这样的需求,用户在输入文字的过程中,可能不想继续输入了,通过滑动或者点击其他位置(除软键盘和EditText以外的任何位置),希望能够自动收回键盘,这个功能可能有些 ...

  2. JQuery实现表格自动增加行,对新行添加事件

    实现功能: 通常在编辑表格时表格的行数是不确定的,如果一次增加太多行可能导致页面内容太多,反应变慢:通过此程序实现表格动态增加行,一直保持最下面有多个空白行. 效果: 一:原始页面 二:表1增加新行并 ...

  3. JQuery实现表格动态增加行并对新行添加事件

    实现功能: 通常在编辑表格时表格的行数是不确定的,如果一次增加太多行可能导致页面内容太多,反应变慢:通过此程序实现表格动态增加行,一直保持最下面有多个空白行. 效果: 一:原始页面 二:表1增加新行并 ...

  4. JS 实现点击页面任意位置隐藏div、span

    通过调用下面的 showhidden(“标签ID”) 显示div/span/…等标签内容,可以实现点击页面任意地方再次隐藏该标签内容,而showhidden(“标签ID”,”nohidden”)可保存 ...

  5. winform 窗口点击窗体任意位置移动窗体

    private bool _isDown; private Point _mousePoint; private void Users_MouseDown(object sender, MouseEv ...

  6. C# 点击窗口任意位置拖动

    代码: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; ...

  7. Swift 3 点击屏幕任意位置隐藏键盘

    func hideKeyboardWhenTappedAround() { let tap: UITapGestureRecognizer = UITapGestureRecognizer(targe ...

  8. [转载]GridView中点击某行的任意位置就选中该行

    原文链接:http://www.cnblogs.com/Echo529/p/4521701.html GridView中点击某行的任意位置就选中该行 分类: 第一步:添加选择列 点击GridView右 ...

  9. GridView点击行触发SelectedIndexChanged事件

    1.在<% @Page ...... %>指令中添加 EnableEventValidation="false" 2.在RowDataBound事件中添加 protec ...

随机推荐

  1. pycharm在同目录下import,pycharm会提示错误,但是可以运行

    原因是:    pycharm不会将当前文件目录自动加入自己的sourse_path. 解决方案:右键make_directory as-->sources path将当前工作的文件夹加入sou ...

  2. DevOps - 版本控制 - Gogs

    Gogs Gogs官网:https://gogs.io Gogs文档:https://gogs.io/docs Gogs配置文件手册:https://gogs.io/docs/advanced/con ...

  3. 【转】JSP提交表单

    设计表单页面,它是静态页面,使用HTML编写,而且使用了JavaScript脚本语言来验证填写表单数据,表单页面为form.htm,代码如下: <html><head>< ...

  4. 动态规划:HDU1003-Max Sum(最大子序列和)

    Max Sum Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Su ...

  5. 数论:HDU1066-Last non-zero Digit in N!

    题目: Last non-zero Digit in N! Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K ...

  6. Django templates(模板)

    为什么用templates? views.py视图函数是用来写Python代码的,HTML可以被直接硬编码在views.py之中.如下: import datetime def current_tim ...

  7. RF,GBDT,XGBoost,lightGBM的对比

    转载地址:https://blog.csdn.net/u014248127/article/details/79015803 RF,GBDT,XGBoost,lightGBM都属于集成学习(Ensem ...

  8. cf979d Kuro and GCD and XOR and SUM

    set做法 正解是trie-- 主要是要学会 \(a\ \mathrm{xor}\ b \leq a+b\) 这种操作 #include <iostream> #include <c ...

  9. Creating Hyperv Agent Installer

    Creating Hyperv Agent Installer   Skip to end of metadata   Created by Anshul Gangwar, last modified ...

  10. imx6移植librtmp

    一.openssl交叉编译 1.下载 https://www.openssl.org/source/ 版本不要太高,刚开始版本高了,有些函数取消了,链接不上 使用1.0.1f即可 2.编译成共享库 . ...