开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜