GridView控件RowDataBound事件中获取列字段

泛微OA与金蝶云星空深度集成实战:审批与表单双场景解析 本文深入解析泛微OA与金蝶云星空的深度集成实战,聚焦审批流程与表单对接两大核心场景。通过具体案例,详细阐述了如何实现业务数据与审批流程的自动联动,打破数据孤岛,提升企业运营效率与数据一致性,并分享了接口设计、安全策略及实战避坑指南。 阅读详情

GridView是ASP.NET中功能强大的数据显示控件,它的RowDataBound事件为我们提供了方便的控制行、列数据的途径。 软件开发网 www.mscto.com

要获取当前行的某个数据列,有如下几种方法:

 

1. Cells[x].Txt。
    从列单元格的文本值获取。这种方法简单高率,最为常用,但是功能单纯。此法存在几个缺点:
    (1)无法获取到设置了隐藏属性的数据列的值,所取到的值为“”(空)。
    (2)只能获取在HTML中定义过的数据列,无法查询数据源中的当前数据行的所有字段列。一般情况下,通过HTML设置GridView的字段列的数量往往小于数据源的实际字段数量,这是因为从业务逻辑的角度看,并不是所有的字段都是要显示在页面上的。当需要使用没有被显示的字段时,此法就不能直接满足需求了。

 

 

2. e.Row.Cells[x].FindControl("YourcontrolName")。
    这是在单元格内查找某个服务器控件,从而获得其数据值。这种方式可以操作单元格内的服务器控件。此法一般用于处理模板列中的数据或控件。

3. (DataRowView)e.Row.DataItem).Row.ItemArray[x].ToString()。
    此法的核心是e.Row.DataItem,它是GridView的行数据集,为Object类型,将其转化为DataRowView类型后,可以获得更多的操作方法。此数据集表示数据源当前行的全部字段列,ItemArray[x]是当前行全部字段列的数组对象,可以通过索引x获得任意字段值。此法的强悍之处是可以对数据源的全部字段查询。

4. DataBinder.Eval(e.Row.DataItem, "YourDataFieldName").ToString()。
    此法仍然基于e.Row.DataItem,其特点是更快捷的获得数据源的任意字段值,因为使用了DataBinder.Eval(),需要注意的是不要写错字段名称。 软件开发网 www.mscto.com

5. 将e.Row.DataItem转化为自定义类型,实现数据类型化。
    例如:
    DSRequestTracking.TB_RequestTrackingRow rtrow=(DSRequestTracking.TB_RequestTrackingRow)((DataRowView)e.Row.DataItem).Row;
    RequestStatusDropDownList1.SelectedValue = rtrow.StatusID.ToString();
    其中DSRequestTracking是通过DSRequestTracking.xsd文件在工程中自定义的强类型DataSet, TB_RequestTrackingRow是VS自动为此强类型生成的创建数据行对象的方法。通过此法,实现了类型化数据的广泛应用。数据类型化的好处很多,显而易见的便是传一个类型数据给方法,取代一大堆参数,另外就是再也不会发生字段名拼写错误的情况。

【51单片机仿真】基于51单片机设计的多功能电子时钟日历(实时时钟闹钟秒表温度检测)系统__资料编号5 该项目是基于单片机的多功能电子时钟系统,集成了时间显示、闹钟设置、秒表功能以及温度显示等功能。主要硬件包括1602液晶显示屏、DS1302时钟芯片、DS18B20温度传感器和蜂鸣器。系统通过按键进行时间和闹钟的设置,并实时显示当前时间和温度。 阅读详情

相关推荐

【python】geopandas库安装出现各种问题?可以看看这篇文章

geopandas的安装方法

jgsecurity的博客 3888

Asp.net 如何获取GridViewRow

在用GridView控件时,我们经常会碰到获取当前行的索引,通过索引进行许多操作。例如,可以获得当前行某一个控件元素;设置某一元素的值等等。下面结合实例介绍几种获得GridView当前行索引值的方法。 实例: ① 目的:获取GridView中RowCommand的当前索引行。 ② 前台页面:在GridView中添加一模版列,里面添加一个LinkButton控件。 代码: CommandAr

qiao929119974的专栏 2164

Augustus手动安装教程

本文记载了如何结合conda手动安装Augustus

m0_65437087的博客 1257

在Gridview中获取当前行的GridviewRow对象

开头好久没有写了,这次写的是一个很简单的方法,大概的样子就像下图,点击Display后需要得到GridiviewRow对象。正文很自然想到的第一个方法就是Parent属性,使用两个Parent就可以得到GridviewRow对象,第一个Parent得到的是DataControlFieldCell。    protected void btnDisplay_Command(o

allenle的专栏 3431

QCC51XX---人机接口设备协议( HID)

QCC51XX---人机接口设备协议( HID)

weixin_42162924的博客 820

把 ABAP ALV 做成可点、可改、可保存:Interactive Editable ALV Grid 的一套落地打法

文章摘要(148字): SAP ALV报表开发中,交互式可编辑网格的实用方案需解决三个核心问题:数据展示、交互下钻与编辑保存。本文以SCARR航空公司和SFLIGHT航班数据为例,演示如何实现双击主列表下钻明细、动态切换编辑模式、精确保存修改的技术路线。关键点包括:通过PF-STATUS添加业务按钮、使用CHECK_CHANGED_DATA同步前端修改、保护关键字段避免误操作,以及变更数据的审计跟踪方法。该方案适用于SAP GUI环境下的快速业务调整需求,相比Fiori开发具有更高的实施效率。

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 232

DataGrid操作的一些总结

1.DataGrid动态绑定字段有时候我们会遇到在DataGrid中动态绑定某个字段的情况,比如:当显示中文时我们绑定cname,显示英文时我们要绑定ename,此时我们可以这样:ButtonColumn:if (language == "cn")((ButtonColumn)this.DataGrid1.Columns[3]).DataTextField = "cname"...

weixin_30338481的博客 174

QGis二次开发 —— 5、基于qgis开发多种在线地图预览,并加入经纬度坐标显示等(附:源码)

QGis二次开发 —— 5、基于qgis开发多种在线地图预览,并加入经纬度坐标显示等(附:源码

370

在datagrid控件中显示多列的方法

DBGrid默认的只有两列,添加列的方法可以:1鼠标右键控件,选择里面的EDIT后,继续右键点击控件,这个时候右键菜单会发生变化,里面有insert,append,点就可以添加列啦。多试两次就可以啦!2使用columns类添加在InputDataDlg.h中,有一个成员变量m_nColumn表明列数,int m_nColumn;在InputDataDlg.cpp中//定义标题头TCHAR strT

jayfunk的专栏 1762

从原理到落地:Mamba-YOLOv8 全面实战指南(源码 + 训练 + 部署一次学会)

在目标检测领域,CNN与Transformer的较量从未停歇。本文提出一种革命性的架构——,将状态空间模型(SSM)首次引入YOLO框架。实验表明,该模型在COCO数据集上达到54.3% mAP@0.5,推理速度达89 FPS(RTX 4090),相比原版YOLOv8提升12.7%精度与23%速度。本文将完整揭示其技术原理与工程实现,助您掌握这一前沿技术。

FJN110的博客 121

在zcu102开发板上使用PetaLinux运行Qt程序

请注意,上述步骤只是一个概述,并且可能需要根据特定的开发环境和要求进行适当的调整。如果你是一个初学者或者对于这些领域不太熟悉,建议在尝试之前阅读相关的文档和教程,或者寻求专业人士的帮助。在"Projects"菜单中,选择"Build & Run"选项,并在"Build"步骤中选择正确的工具链。注意:如果Qt程序依赖于其他库文件,需要将这些库文件一起复制到PetaLinux工程的根文件系统目录中,并在Qt程序中正确地配置库文件路径。如果一切顺利,PetaLinux系统将启动,并自动运行Qt程序。

UhxzCombined的博客 698

GridView控件RowDataBound事件中获取列字段的几种途径

GridView是ASP.NET中功能强大的数据显示控件,它的RowDataBound事件为我们提供了方便的控制行、列数据的途径。<br /><br />要获取当前行的某个数据列,我在实践中总结有如下几种方法:<br /><br />1. Cells[x].Txt。<br />    从列单元格的文本值获取。这种方法简单高率,最为常用,但是功能单纯。此法存在几个缺点:<br />    (1)无法获取到设置了隐藏属性的数据列的值,所取到的值为“”(空)。<br />    (2)只能获取在HTML中定义过的

jiang0609的专栏 411

树莓派 RP2350B 开发环境搭建

本文介绍了树莓派RP2350B开发环境的搭建过程。

张一西的博客 287

GridView控件RowDataBound事件中获取列字段的几种方法

GridView是ASP.NET中功能强大的数据显示控件,它的RowDataBound事件为我们提供了方便的控制行、列数据的途径。 要获取当前行的某个数据列,有如下几种方法: 1. Cells[x].Txt。 从列单元格的文本值获取。这种方法简单高率,最为常用,但是功能单纯。此法存在几个缺点: (1)无法获取到设置了隐藏属性的数据列的值,所取到的值为“”(...

issacm4的博客 341

android 蓝牙通讯demo

android 下蓝牙通讯demo,实现了发现蓝牙,使能蓝牙,通过蓝牙发送消息。

RU DOS版、EFI版32bit/64bit BIOS常用工具

DOS版、EFI版的RU工具,可用来查看IO、MEM、PCI、SMBIOS等资源。亲测在EFI SHELL下可用。

GridView控件RowDataBound事件中获取列字段途径

要获取当前行的某个数据列,在实践中总结有如下几种方法:1. Cells[x].Txt。    从列单元格的文本值获取。这种方法简单高率,最为常用,但是功能单纯。此法存在几个缺点:    (1)无法获取到设置了隐藏属性的数据列的值,所取到的值为“”(空)。    (2)只能获取在H

'尛東峝學. 727

深度学习工具包 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")

GridView控件RowDataBound事件中获取列字段值的几种途径 !!!

C# code <!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> protected void GridView1_RowDataBound(object sender, GridViewRow

single_killer的专栏 9743

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

GridView控件RowDataBound事件中获取列字段值的几种途径

前台: <asp:TemplateField HeaderText="充值总额|账号余额"> <ItemTemplate> <asp:Label ID="lblSurplusMoney" runat="server" Text=""></asp:...

weixin_30408309的博客 246
上一篇: ORA-12514 监听程序当前无法识别连接描述符中的服务
下一篇: 高效删除Oracle数据库中重复数据的方法
rubychen410
博客等级 码龄19年 32粉丝 95原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值