gridview select button to be a link to a page
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?
Use a TemplateField
to custom style a column.
<Columns>
... your other columns ...
<asp:TemplateField HeaderText="Link">
<ItemTemplate>
<a href='<%# "mypage.aspx?selectedName=" + Eval("Name") %>'>Click me</a>
</ItemTemplate>
</asp:TemplateField>
</Columns>
Where Name
is the name of the field that contains the name of the person.
精彩评论