将数据库中的值绑定到gridview中的超链接 [英] Bind value from database into hyperlink in gridview
本文介绍了将数据库中的值绑定到gridview中的超链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我想动态地将数据库中的值绑定到gridview超链接。
请帮助我!!
解决方案
http://abhijitjana.net/2010/07/27/how-to-pass-multiple-values-using-gridview-hyperlinkfield/ [ ^ ]
http://stackoverflow.com/questions/6539667/how-to-bind-the-url-of-a-gridview-hyperlinkfield-when-the-bound-value-contains-a 一> [ ^ ]
在网格视图中创建模板字段。添加超链接并使用Eval或Bind将值设置为所需的超链接属性。
在gridview设计中添加带有超链接的模板字段
< asp:templatefield headertext = 下载 xmlns :asp = #unknown >
< itemtemplate>
< asp:hyperlink id = hlDownload runat = server >
NavigateUrl = ' <%#〜/ Downloads+ Eval(FileName)%>'
Text = 下载目标= ' <%#_ blank%>' > < / asp:超链接 >
< / itemtemplate >
< / asp:templatefield >
然后你可以绑定数据gridview的字段名称'FileName'
Hi All,
I want to dynamically bind a values from database into a gridview hyperlink.
pls help me!!解决方案http://abhijitjana.net/2010/07/27/how-to-pass-multiple-values-using-gridview-hyperlinkfield/[^]
http://stackoverflow.com/questions/6539667/how-to-bind-the-url-of-a-gridview-hyperlinkfield-when-the-bound-value-contains-a[^]
Hi,
Create templatefield within grid view. Add hyperlink and use Eval or Bind to asign value to desired hyperlink property.
In your gridview design add a template field with a hyperlink
<asp:templatefield headertext="Download" xmlns:asp="#unknown"> <itemtemplate> <asp:hyperlink id="hlDownload" runat="server"> NavigateUrl='<%# "~/Downloads"+Eval("FileName") %>' Text="Download" Target='<%# "_blank" %>'></asp:hyperlink> </itemtemplate> </asp:templatefield>
Then you can bind the data with a field name 'FileName' to the gridview
这篇关于将数据库中的值绑定到gridview中的超链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文