使用网格视图将所选行的数据发送到下一页 [英] Send Data Of Selected Row to Next Page Using Grid View

查看:53
本文介绍了使用网格视图将所选行的数据发送到下一页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,



我在gridview上做了例子..网格我已经拿了一个链接按钮,


$单击该链接按钮后b $ b,我想将所选行的所有数据发送到下一页。



任何人都可以告诉我..?



thanx

解决方案

请参阅此处,

http://www.aspsnippets.com/Articles/Pass-Selected-Row-of- ASPNet-GridView-control-to-another-Page.aspx [ ^ ]


有两种方法可以实现:



1)客户端

2)服务器端



使用客户端方法可以使用查询字符串或cookie将值传递到下一页。为此,您必须使用gridview的RowDataBound事件将客户端onclick函数绑定到链接按钮。要阅读有关RowDataBound事件的信息,请访问:



http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.rowdatabound.aspx [ ^ ]



http://www.dotnetgallery.com/kb/resource17-RowDatabound-event-tips-and-tricks-in-Gridview-control.aspx [ ^ ]



使用服务器端方法,您必须使用gridview的RowCommand事件并存储详细信息。可能使用Session对象。在下一页,您可以访问详细信息。要阅读有关RowCommand事件的信息,请访问:



http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.rowcommand.aspx [ ^ ]



http://www.c -sharpcorner.com/uploadfile/syedshakeer/rowcommand-event-in-gridview/ [ ^ ]



如果我这样做,我会选择第一个选项但我会使用行的ID作为查询字符串传递到下一页,以便可以从数据库中检索数据。如果其他人在流程之间修改数据,这也可能导致检索准确的数据。


检查:

八种不同的方式将数据从一个页面传输到另一页 [ ^ ]

gridview中的链接按钮 [ ^ ]

Hello,

Am doing example on gridview ..in grid i have taken one link button,

after clicking that link button ,i want to send all data of selected row to next page.

can anybody tell me..?

thanx

解决方案

Refer here,
http://www.aspsnippets.com/Articles/Pass-Selected-Row-of-ASPNet-GridView-control-to-another-Page.aspx[^]


There are two ways to achieve that:

1)client side
2)Server side

With client side approach you can use query strings or cookies to pass the values to the next page. For that you will have to bind the client side onclick function to your link button using RowDataBound event of gridview. To read about RowDataBound event visit:

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.rowdatabound.aspx[^]

http://www.dotnetgallery.com/kb/resource17-RowDatabound-event-tips-and-tricks-in-Gridview-control.aspx[^]

With server side approach you will have to use RowCommand event of your gridview and store the details. Probably using Session object. On the next page you can access the details. To read about RowCommand event visit:

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.rowcommand.aspx[^]

http://www.c-sharpcorner.com/uploadfile/syedshakeer/rowcommand-event-in-gridview/[^]

If I would be doing this, I would have opted the first option but I would have used ID of the row as query string to pass to the next page so that the data could be retrieved from Database. That could have also resulted in retrieval of accurate data in case someone else modify the data in between the process.


Check this:
Eight different ways to transfer data from one page to anotherpage[^]
linkbutton in gridview[^]


这篇关于使用网格视图将所选行的数据发送到下一页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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