在listview控件中找不到按钮:(帮助 [英] Cannot find button in listview control :(Help
本文介绍了在listview控件中找不到按钮:(帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,我想在listview控件中获取按钮,但我不知道,该怎么做。
我的ASP.NET代码:
Hello, i want to get button in listview control, but i don't know, how to do it.
My ASP.NET CODE:
<asp:ListView ID="lv_Links" runat="server" >
<LayoutTemplate>
<ul style="list-style: none;">
<asp:PlaceHolder ID="ItemPlaceholder" runat="server" />
</ul>
</LayoutTemplate>
<ItemTemplate>
<ul style="list-style: none;padding: 0;">
<li> <asp:HyperLink ID="LinkItem" runat="server" Text='<%# Eval("Description") %>'
NavigateUrl='<%# Eval("Link") %>'>
</asp:HyperLink> <asp:ImageButton ID="Button2" ImageUrl="~/_layouts/Portal.Croc.Box.Social.ForNewEmployee/i/delete.gif" itemid='<%# Eval("ID") %>' OnClick="delete_Onclick" OnClientClick="return confirm('Вы действительно хотите удалить ссылку?');" Width="14px" Height="14px" runat="server"/> </li>
</ul>
</ItemTemplate>
</asp:ListView>
Code Behind:
Code Behind:
protected void Page_Load(object sender, EventArgs e)
{
SPWeb oWebs = SPContext.Current.Web;
String Editors = "Новому сотруднику – модераторы";
String Owners = oWebs.Site.RootWeb.AssociatedOwnerGroup.ToString();
if (oWebs.SiteGroups[Editors].ContainsCurrentUser || oWebs.SiteGroups[Owners].ContainsCurrentUser)
{
HyperLink1.Visible = true;
foreach (ListViewItem item in lv_Links.Items)
{
ImageButton ddrList = (ImageButton)item.FindControl("Button2") as ImageButton;
ddrList.Visible = true;
}
}
else
{
}
}
但它不起作用:(帮助
推荐答案
您应该检查这些..
处理来自ASP.NET ListView控件的按钮单击事件 [ ^ ]
ASP.NET 3.5中的完整ListView [ ^ ]
You should check these..
Handle the button click event from an ASP.NET ListView control[^]
Complete ListView in ASP.NET 3.5[^]
这篇关于在listview控件中找不到按钮:(帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文