如何向GridView添加按钮绑定到Datatable ASP.Net [英] How to add button to GridView bound to Datatable ASP.Net

查看:73
本文介绍了如何向GridView添加按钮绑定到Datatable ASP.Net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的网络表单中有一个GridView。我将数据源设置为DataTable,然后绑定它。当我尝试通过选择启用编辑/更新/删除添加编辑按钮时,它没有显示。



但是,我设法手动显示按钮。单击按钮时,如何获取行的第一个单元格值,其中单击了按钮?

I have a GridView in in my webform. I set the data source as a DataTable, and bind it. When I tried adding an edit button by selecting "Enable edit/update/delete", it wasn't showing up.

But, I managed to show the button manually. On button click, how do I get the first cell value of the row, of which the button is clicked ?

推荐答案

您可以在 GridView.RowCommand事件 [< a href =http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.rowcommand(v=vs.110).aspx\"target =_ blanktitle =New窗口> ^ ]。



或者您可以直接在Button Click事件中获取。示例在 - 按钮单击行时在C#Gridview中获取单元格值 [ ^ ]
You can get the Row details in GridView.RowCommand Event[^].

Or you can directly get that inside the Button Click Event. Example at - Get Cell Value in C# Gridview when Button clicked on row[^]


这篇关于如何向GridView添加按钮绑定到Datatable ASP.Net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆