gridview选择按钮是指向页面的链接 [英] gridview select button to be a link to a page
本文介绍了gridview选择按钮是指向页面的链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想拥有一个gridview,其中第一个字段是到页面的链接,例如mypage.aspx?selectedName = John(如果选择了john行)或mypage.aspx?selectedName = Jim(如果选择了Jim行).如何为每一行创建链接?
I want to have a gridview where the first field is a link to a page like mypage.aspx?selectedName=John if john row is selected or mypage.aspx?selectedName=Jim if Jim row is selected. How can I create the link for each row?
推荐答案
使用TemplateField
自定义样式列.
<Columns>
... your other columns ...
<asp:TemplateField HeaderText="Link">
<ItemTemplate>
<a href='<%# "mypage.aspx?selectedName=" + Eval("Name") %>'>Click me</a>
</ItemTemplate>
</asp:TemplateField>
</Columns>
Name
是包含人员姓名的字段的名称.
Where Name
is the name of the field that contains the name of the person.
这篇关于gridview选择按钮是指向页面的链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文