单击GridView中的一行 [英] click on a row in GridView

查看:65
本文介绍了单击GridView中的一行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





i有一个gridview,它显示一些列而不是所有的SQL-Server数据库表



我的SQLDataSource选择是:SELECT id,Name,Age FROM Employees



现在我想点击GridView中的一行将我重定向到一个显示记录的所有列的页面。



我如何点击GridView中的一行并将我重定向到myPage.aspx?id = id





谢谢



i have a gridview in which it displays some columns not all of a SQL-Server database table

my SQLDataSource select is: SELECT id, Name, Age FROM Employees

now i want to click on a row in the GridView to redirect me to a page that shows all the columns of a record.

How can i click on a row in the GridView and redirect me to myPage.aspx?id=id


Thanks

推荐答案

根据我的理解你的要求是什么,如果你点击gridview行,根据你要重定向到另一个页面的行ID。



如果你需要,那么使用gridview的HyperLinkField,并使用下面的属性



1)DataNavigateUrlFields:查询字符串字段

2)DataNavigateUrlFormatString:该页面的URL



As per my understand the thread your requirement is, If you click on gridview row, based on row id you wants to redirect to another page.

If that is your need, then use HyperLinkField of gridview, and use below properties

1) DataNavigateUrlFields : Query string fields
2) DataNavigateUrlFormatString : URL of that page

<asp:hyperlinkfield text="View" datanavigateurlfields="Id,Desc,Short_Desc" datanavigateurlformatstring="~/Page2.aspx?CL_Id={0}&CL_Desc={1}&CL_Short_Desc={2}" xmlns:asp="#unknown" />





有关详细信息,请参阅以下链接

http://www.dotnetspider.com/resources/45377-How-pass-Gridview-Parameters-another-page-using -HyperLinkField.aspx [ ^ ]


这篇关于单击GridView中的一行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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