在Gridview中创建超链接以查看实体的详细信息
问题描述:
我有一个网格视图,其中包含以下详细信息: -
用户名id
现在我想添加一个其他的超链接列,并希望以一种方式编码,它导航我选择的用户配置文件
例如
用户名密码超链接
123 23q showdata
432 resd showdata
当我点击第一个显示数据时它应导航到123个配置文件
当我点击第二个显示数据时它应该导航到432 profile
I have a grid view with following details:-
username id
now i want to add a other hyperlink column and want to code in a fashion that it navigate me to selected user profile
for eg
username password hyperlink
123 23q showdata
432 resd showdata
when i click first show data it should navigate to 123 profile
and when i click second show data it should navigate to 432 profile
答
将TemplateField
添加到GridView
并在其中定义HyperLink
。使用NavigateUrl
HyperLink
的属性来声明它将导航到的页面网址,其中个人资料ID为QueryString
参数。
参考 - 单击gridview内的超链接时,它应重定向到页面,然后在taget页面上,根据ID获取数据 [ ^ ]。
Add aTemplateField
to theGridView
and define aHyperLink
inside that. UseNavigateUrl
property ofHyperLink
to declare the page url which it will navigate to with the profile id as aQueryString
parameter.
Refer - On clicking the hyperlink inside gridview, it should redirect to a page and and on the taget page, fetch the data depending upon the ID[^].