[英]how have access to datalist htmlanchor(href) control inside ItemTemplate?
here the datalist with linkresponder like htmlanchor control 这里的数据列表与htmlanchor控件一样具有linkresponder
<asp:DataList ID="DataListComment" runat="server" DataKeyField="username"
EnableViewState="False" RepeatColumns="1">
<ItemTemplate>
<br />
<a href='<%# Eval("commentid", "comment.aspx?commentid={0}") %>'
runat="server" id="linkresponder" text='<%# Eval("commentname") %>'>
<asp:Label ID="Label2" runat="server"
Text='<%# Eval("commentdate") %>' />
</a>
</ItemTemplate>
</asp:DataList>
my try with no result 我的尝试没有结果
foreach
(DataListItem item in DataListComment.Items)
{
HtmlAnchor link = item.FindControl("linkresponder") as HtmlAnchor;
link.Visible = false;
}
将锚标记转换为asp:LinkButton
或asp:HyperLink
控件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.