通过数据网格链接 [英] link through data grid
本文介绍了通过数据网格链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何通过数据网格在网页中添加链接
例如"http://screencast.com/t/JU3JqaOITy6r"
how to add a link through data gridin web page
like "http://screencast.com/t/JU3JqaOITy6r"
推荐答案
看看 ^ ]
最简单的是使用ItemTemaplate
并使用<%# %>
语法
我假设您要绑定到数据源
Have a look at Mastering Databinding[^]
Easiest was is to have anItemTemaplate
and use the<%# %>
syntax
I''m assuming you''re binding to a datasource
将gridview的AutoGeneratedColumns属性设置为false,然后在itemtemplate字段中添加带有href的链接.
Set the AutoGeneratedColumns property of gridview to false and then in itemtemplate field add your link with a href.
<asp:gridview id="gridview1" runat="server" autogeneratedcolumns="false">
<columns>
<templatefield headertext="">
<itemtemplate>
<a href="your link">Name of link</a>
</itemtemplate>
</templatefield>
</columns>
</asp:gridview>
在ItemTemplate中,您还可以根据需要放置超链接,linkbutton或任何控件.
祝你好运.
In ItemTemplate you can also place hyperlink, linkbutton or any controls as per your requirements.
Good luck.
这篇关于通过数据网格链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文