使用C#中的向上和向下按钮移动datagridview的行 [英] Moving rows of datagridview using up and down button in C#

查看:94
本文介绍了使用C#中的向上和向下按钮移动datagridview的行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我想使用向上和向下按钮移动datagridview的选定行,并且必须将rowIndex发送到数据库.

我通过从以下链接引用代码来完成操作,并且对满足某些条件的代码也做了一些更改



http://www.vbforums.com/showthread.php?t=508749 [ ^ ]

我将DGV中的数据添加到数据表中,然后将DT发送到我的数据库中.现在我还想将行索引添加到DT中并发送它.要求分享一些想法

在此先感谢

Hi,

I want to move the selected row of datagridview using up and down button and have to send the rowIndex to the database.

I have done by referring the code from the follow link and also done few changes to the code for some condition to satisfy



http://www.vbforums.com/showthread.php?t=508749[^]

I''m adding the data in DGV to a datatable and then sending the DT to my database. now I also want to add the row index into the DT and send it. Request to Share some ideas

Thanks in advance

推荐答案

它是一篇不错的文章,介绍如何在asp.net中启用对行的选择.

http://www.codeproject.com/KB/aspnet/GridviewExtender.aspx

在上/下按钮中,根据需要更改所选项目的索引,然后将数据重新绑定到网格中.
its a good article for how to enable selecteion for a row in asp.net.

http://www.codeproject.com/KB/aspnet/GridviewExtender.aspx

inside your UP/DOWN button change the selected item''s index as required and rebind the data to your grid.


这篇关于使用C#中的向上和向下按钮移动datagridview的行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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