单击选中GridView 或 HTML 表格的某行,并获取该行的数据。。。。

使用JavaScript获取GridView选中行信息的方法 JavaScript是一种轻量级的编程语言,最初设计用来在浏览器端添加交互性。随着时间的发展,JavaScript不再局限于浏览器,它已经成为跨平台开发的主流语言之一。无论是前端还是Node.js服务器端,JavaScript都扮演着核心角色。GridView是ASP.NET Web Forms中用于显示数据的控件,它以表格形式展示数据,让开发者能够以声明性方式展示来自数据库或业务逻辑的数据集合。 阅读详情

首先绑定行单击事件,如下:也可以用Jquery的.click进行事件绑定

 protected void GridView1_RowDataBound(Object sender, GridViewRowEventArgs e){
        if (e.Row.RowType == DataControlRowType.DataRow){
            
            e.Row.Attributes.Add("onClick", "javascript:void SelectRow(this);");
        }
    }

然后再前台页面head部分写如下函数:

<script type="text/javascript">
         // 对选中行的处理函数
         function SelectRow(row) {
             var _selectColor = "#303030";
             var _normalColor = "#909090";
             var _selectFontSize = "3em";
             var _normalFontSize = "2em";
             // 获取当前行的所有数据单元
             var _rows = row.parentNode.childNodes;
             // 获取数据
             try {
                 for (i = 0; i < _rows.length; i++) {
                     var _firstCell = _rows[i].getElementsByTagName("td")[0];
                     _firstCell.style.color = _normalColor;
                     _firstCell.style.fontSize = _normalFontSize;
                     _firstCell.style.fontWeight = "normal";
                 }
             }
             catch (e) { }
             // 对该行的第一个单元格设样式
             var _selectedRowFirstCell = row.getElementsByTagName("td")[0];
             _selectedRowFirstCell.style.color = _selectColor;
             _selectedRowFirstCell.style.fontSize = _selectFontSize;
             _selectedRowFirstCell.style.fontWeight = "bold";
         }
</script>


 


Js 获取Gridview选中行的内容操作步骤 本文将介绍一下Js获取Gridview选中行的内容的过程及步骤:取得gridview中获取选中行指定列的值.获取鼠标点击的元素等等,感兴趣的朋友可以了解下,或许对你学习js方面知识有所帮助 立即下载

相关推荐

REST-meta-MDD Data总结

sMRI数据使用:nwc1、nwc2、nwc3(同样数据集相关论坛中有相关信息指向需要使用wc1、wc2、wc3)多方咨询与讨论后决定使用nwc数据,这里说明wc数据相对wc数据要大的多如wc1的大小为1.33GB,而nwc1的数据却有6.90GB。VBM文件:/REST-meta-MDD/Sharing/REST-meta-MDD-VBM- phase1 -Sharing.tar.gz。1、Excel中的表型信息:1-男,2-女;-9999或空白表示缺少数据。

2404_88295660的博客 1532

点击每一行的某个单元格,获取这一行的数据。

先看一下业务。 标题上面是业务,点击右边的编辑。在模态框中显示本行的一些信息 接下来看代码 &lt;table class="table table-striped table-bordered table-hover" id="dataTables-example"&gt; &lt;thead&gt; &lt;tr&gt; &lt;th class="text-...

文和的博客 4396

sentaurus学习笔记(一)器件仿真

之前有跟大家说,以后转到sentaurus,因此silvaco会用的比较少,结果发现真的有一点贪心厌旧的感觉,现在基本上不用silvaco(lll¬ω¬)故这篇文章,将为大家带来的是关于sentaurus的结构仿真和器件的特性的提取。我们还是老规矩,先上结构图。 还是一个经典的IGBT结构,这是一个典型的N型IGBT,下面我将把一些相关的结构,和具体的写法用下面一幅图表达出来。 这里因为方便看,我们把器件的比例画的比较抽象。可以看到的是,这里有很多的距离参数是用一些变量名来写的,这也是sentaurus

weixin_43262021的博客 2万+

【HTML】js Table单击事件,获取表格行和列及单元格数值的方法

【代码】[HTML]js Table单击事件,获取表格行和列及单元格数值的方法。

德仔 1万+

当R语言遇见MaxENT:参数优化的艺术与自动化调参实践

本文探讨了R语言与MaxENT在生态位建模中的结合应用,重点介绍了参数优化与自动化调参的实践方法。通过caret与ENMeval工具链,研究人员可以高效处理多物种、多环境变量的大规模分析任务,提升模型性能与工作效率。文章还涵盖了从数据准备到结果可视化的全流程,为生态学家提供了实用的技术指导。

corn8的博客 455

Gromacs文件格式全解析:xtc vs trr vs cpt,哪种更适合你的模拟需求?

本文深入解析Gromacs分子动力学模拟中的三种核心文件格式xtc、trr和cpt,详细对比其技术特性和适用场景。xtc适合存储效率优先的场景,trr保留完整动力学数据,cpt确保模拟精确重启。通过实际配置示例和存储优化技巧,帮助用户根据模拟需求选择最佳格式组合,平衡分析灵活性与存储成本。

weixin_29281941的博客 96

html 双击选择该行的值,JS 获取鼠标所点击表格中的某行某列的值

BINGObody,html {background: white;padding: 0px;margin: 0px;font-size: 45px;color: red;text-align: center;}th,td {width: 100px;}window.onload = function() {for (var i = 0; i < 24; i++) {document.get...

weixin_33384949的博客 436

Allegro File菜单实战指南:从导入网表到导出BOM的完整流程

PCB设计离不开对EDA软件菜单体系的深入理解。在Cadence Allegro中,File菜单是数据流转的中枢,它不仅是新建、打开、保存的基础入口,更是连接原理图与版图、设计与制造的关键桥梁。工程师常遇到的“导入网表报错”“导出BOM为空”“板框不闭合”等高频问题,大多源于对File菜单中Import与Export功能的理解不到位。从基础概念出发,先厘清Import(网表、DXF、IPC)与Export(BOM、ODB++、DXF)的工作原理,再结合版本兼容、封装库路径、单位设置等工程细节,即可构建完整的

weixin_32950759的博客 295

html表格选中行事件,单击选中GridView 或 HTML 表格的某行,并获取该行的数据。。。。...

首先绑定行单击事件,如下:也可以用Jquery的.click进行事件绑定protected void GridView1_RowDataBound(Object sender, GridViewRowEventArgs e){if (e.Row.RowType == DataControlRowType.DataRow){e.Row.Attributes.Add("onClick", "javas...

weixin_39843677的博客 652

C#创建COM组件,QT调用COM组件简单测试(VS2008+QT4.6.4)

一. C#创建组件: 1. VS2008新建一个项目,选择Visual C#, Class library 修改Properties下面的AssemblyInfo.cs文件,ComVisible属性设置为True,即:[assembly: ComVisible(true)] 2. 右击项目,选择“属性”, 选择“生成”选项卡,把“为COM互操作注册”勾选上 选择“签名”选项卡,把“

3517

ADS2020实战:村田电感.s2p与.mod文件导入全流程对比(附仿真结果差异分析)

本文详细对比了ADS2020中村田电感的.s2p与.mod文件导入流程及仿真结果差异,重点分析了两种模型在低频段和高频段的精度表现。通过实际案例展示.s2p文件在高频仿真中的优势,以及.mod文件在低频和非线性特性模拟中的准确性,为射频电路设计提供模型选择策略和混合仿真技巧。

weixin_29289821的博客 519

html gridview 效果,使用HTML表格而不是Gridview

我想使用HTML表格而不是gridview来检查数据。为什么HTML表格?因为我将使用输出发送电子邮件,所以我更喜欢HTML表格而不是gridview。另外我不想使用对象,因为系统只能在服务器上运行。它会自动发送一封电子邮件。任何人都可以帮我解决我的问题吗?谢谢。使用HTML表格而不是Gridview这是我到目前为止。在下面的例子中,我使用了gridview,因为我不知道如何使用Append来使用...

weixin_34998630的博客 522

YOLOv13优化Faster_Block:卷积(Partial Convolution)、多层感知机(MLP)结构和残差连接

Faster_Block 代表了现代深度学习中效率与性能平衡的一个典型案例。它通过部分卷积技术巧妙地减少了计算开销,同时通过精心设计的架构保持了强大的特征学习能力。这种设计思想对于移动端部署、实时应用和大规模模型训练都具有重要意义。 未来的发展方向可能包括更智能的动态分割策略、与新兴硬件的深度适配,以及与其他先进技术(如自注意力机制、神经架构搜索等)的结合。Faster_Block 的成功展示了在深度学习领域,创新往往来自于对问题本质的深刻理解和巧妙的工程实现。

FJN110的博客 427

Dev中导出GridView表格数据

/// <summary> /// 导出表格数据到文件 /// </summary> /// <param name="gridView"></param> /// <param name="strCaption"></param> public static void ExportFile(GridView gridView, str...

言午独行 771

老版QQ原生表情gif动态

这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

只选中GridView中的一个CheckBox

一.html控件 function SignCheck(cbox) { var obj = document.getElementsByTagName("input"); for (var i=0; i { if(obj[i].type == "checkbox") { obj[i].checked = false; } var sid = cbox.id;

wanglei_smartfish的专栏 2431

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

js获取GridView中行数据的两种方法

第一种方法: function submitData() {     var tb = document.getElementById(IDArray[0]);   //获取服务器控件GridView的ID     if (tb)      {     var rows = tb.rows;     for (var i = 1; i         v

fans_langdou的专栏 1025

Outlook Express 6 (OE6) for Win7/Win8/Win10

英文版 Outlook Express6.0, 兼容Win7/Win10/WinXP,解压就可用。

html中的checkbox如何在GridView选中并取值(c#)

using System;using System.Data;using System.Configuration;using System.Collections;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.We

sy1988xzf的专栏 1135

通过 javascript 访问 GridView/DataGrid 选中 CheckBox 行各列的值

<br />http://www.cnblogs.com/Jinglecat/archive/2007/07/15/818967.html<br /> <br /> <br /> <br />功能需求<br /><br />1,  单击 checkbox 返回当前行值<br />2,  外部按钮获取所有选择行的值<br /><br /><br />实现说明<br /><br />参见主要代码,代码为自说明式。<br /><br /><br />主要代码<asp:GridView ID="GridView1"

zhuxiangshengwww的专栏 508

html gridview excel,将GridView数据导出Excel表格

[c#]代码库protected void btnExport_Click(object sender, EventArgs e){gridView.DataSource =dt; //DataTable数据gridView.DataBind();GridView gd = new GridView();gd = gridView;if (gd.Rows.Count ...

weixin_33330762的博客 239

GridView做增加数据

 在 ASP.NET 2.0 中,GridView 支持修改/删除记录,但却不支持新增记录的功能(个人感觉是 GridVew 的一大缺憾,估计在下一版本中会加入此功能),大多数人建议用 FormView 来完成增加记录的功能,但是 FormView 和 GridView 不是同一个表格,所以无法在同一个页面的同一个表格中显示。如果故意将 FormView 或自己的一堆于用新增功能的控件使用

4254

js取得gridview中获取checkbox选中的值

转自:http://blog.youkuaiyun.com/lijian260/article/details/8505299 js取得gridview中获取checkbox选中的值          测试好半天,才出来,checkbox在第一列,        for( i=1;i          {             var cb=document.all.GVmain.rows(i

古老的未来 759

HTML使用GridView表格边框线一直存在

         HTML 在使用GridView时把边框设置为0px ,但是在页面显示中还是是有网格线。         如图所示:                     在使用了BorderWidth=0px情况下依然有表格线,发现问题所在是GridLines属性未设置成None                       修改后解决问题:                注意事项:     ...

Kelly成长之路 1511

分享[ASP.NET]GridView鼠标停留变色和单击处理事件

1.增加GridView的GVSelect_RowDataBound事件 protected void GVSelect_RowDataBound(object sender,GridViewRowEventArgs e)     {         if (e.Row.RowType ==DataControlRowType.DataRow)         {            

吴立星的博客 1531

GridView鼠标停留变色和客户端单击处理事件

在使用C#写CRM时遇到一个问题,GridView绑定了了数据后,我想在鼠标停留到GridView数据行时,行变色突出显示该行,并且鼠标点击该行时,将该条目的数据显示在GridView下面的控件自动将该行对应的数据显示出来。我的实现步骤是:1.增加GridView的GVSelect_RowDataBound事件protected void GVSelect_RowDataBound(o

rubychen410的专栏 1847

在GridView中加入CheckBox实现全选以及提交CheckBox选中的相关内容

首先我要说明的是:1.实现GridView中CheckBox全选:我采用JavaScript在前台实现。                           2.实现提交CheckBox选中的相关内容:采用的是在后台遍历GridView中的每行,                              筛选出CheckBox选中项,再进行逻辑处理。 1.在GridView中加入,

.NET的专栏 2341
上一篇: 清除一个页面中所有TextBox的值
下一篇: 用JQuery在客户端调用C#后台函数
xiaoding133
博客等级 码龄19年 415粉丝 159原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值