如何使用asp.net&amp ;;复制同一网格视图中的选定行C# [英] How to copy a selected row in same gridview using asp.net & C#

查看:57
本文介绍了如何使用asp.net&amp ;;复制同一网格视图中的选定行C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我的页面中有一个GridView控件,每行都有一个名为Split的按钮,

点击那个按钮应该在同一个gridview中复制。



请给我代码,如何处理它。



感谢和问候,

Harshada

Hi,

I have a GridView control in my page, each row has a button called "Split",
On Click of that button that row should get copied in same gridview.

Please give me code , how to handle it out.

Thanks & Regards,
Harshada

推荐答案

在分割按钮的点击事件上取该行的标识意味着主键是通过此值在该表上的记录,您可以获取该行的所有值,然后在表中再次插入它,这样您就可以添加重复记录。

如果没有解决,那么代码如何执行此操作我们可以提供帮助。
On click event of Split button take Identity for that row means Primary key of that record which is on that table by this value you can get all value of that row then insert it again in table this way you can add duplicate record.
If not solve past you code how you do this we can help.


您好Harshada



onclick事件的Button你可以找到表格的主键如



int ID = Convert.ToInt32(Grid_ShowData.DataKeys [e.NewEditIndex] [ID]。ToString())



其中ID是表的主要键

然后

插入al l数据到该id的表中,并将表格表绑定到gridview。



如果您粘贴代码我给你解决方案
Hi Harshada

onclick event of Button you can find primery key of the table like

int ID = Convert.ToInt32(Grid_ShowData.DataKeys[e.NewEditIndex]["ID"].ToString())

where ID is the primery key of table
then
insert the all data into table of that id, and Bind table table to gridview.

If you paste your code i give you the solution


这篇关于如何使用asp.net&amp ;;复制同一网格视图中的选定行C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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