装载GridView的超链接栏 [英] loading gridview with hyperlink column

查看:113
本文介绍了装载GridView的超链接栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个GridView和通过使autogeneratefields添加一列超链接所有记录。
当这个GridView控件加载,当我点击整个我想重定向到其他页面的查询字符串到该页面通过整个记录的任何记录的超级链接?
任何人可以帮助我在这?


解决方案

这些链接应该阐明如何做到这一点:

如何传递变量直通一个DataGrid超链接列

如何:使用里面的GridView

样code(看超链接的NavigateUrl属性):

 < ASP:GridView控件ID =urlGrid=服务器的AutoGenerateColumns =FALSE>
   <柱体和GT;
      < ASP:的TemplateField>
         <&ItemTemplate中GT;   < ASP:超链接ID =HyperLink1
                  =服务器
                  NavigateUrl ='<%#?RedirectPage.aspx XXXX =&放大器;
                  DataBinder.Eval的(集装箱,DataItem.xxxx)及
                 &放大器; YYYY =&放大器; DataBinder.Eval的(集装箱,DataItem.yyyy)%>'
                  文本=走!>
   < / ASP:超链接>     < / ItemTemplate中>
  < / ASP:的TemplateField>
  < ASP:BoundField的数据字段=网站名称的HeaderText =网站名称/>
   < /专栏>
< / ASP:GridView的>

I have a gridview and added a column "Hyperlink" to all records by enabling autogeneratefields. When this gridview is loaded and when I click the hyperlink across any record I want to redirect to some other page with entire record passed as query string to that page? can anybody help me on this?

解决方案

These links should clarify how to do it:

How to pass variables thru a DataGrid hyperlink column

How To: Use a HyperLink control inside a GridView

Sample code (Look at the NavigateUrl property of HyperLink):

<asp:GridView ID="urlGrid" runat="server" AutoGenerateColumns="False">
   <Columns>
      <asp:TemplateField>
         <ItemTemplate>

   <asp:HyperLink ID="HyperLink1"
                  runat="server"
                  NavigateUrl='<%# "RedirectPage.aspx?xxxx=" &
                  DataBinder.Eval(Container, "DataItem.xxxx") &
                 "&yyyy=" & DataBinder.Eval(Container, "DataItem.yyyy")%>'
                  Text="Go!">
   </asp:HyperLink>

     </ItemTemplate>
  </asp:TemplateField>
  <asp:BoundField DataField="SiteName" HeaderText="Site Name" />
   </Columns>
</asp:GridView>

这篇关于装载GridView的超链接栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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