码迷,mamicode.com
首页 > 其他好文 > 详细

多个LinkButton导航

时间:2015-01-07 10:32:12      阅读:179      评论:0      收藏:0      [点我收藏+]

标签:

界面:
<asp:PlaceHolder ID="PlaceHolder1" runat="server">
<asp:LinkButton ID="LinkButton1" runat="server" OnClick="LinkButton_Click">导航1</asp:LinkButton>
<asp:LinkButton ID="LinkButton2" runat="server" OnClick="LinkButton_Click">导航2</asp:LinkButton>
<asp:LinkButton ID="LinkButton3" runat="server" OnClick="LinkButton_Click">导航3</asp:LinkButton>
<asp:LinkButton ID="LinkButton4" runat="server" OnClick="LinkButton_Click">导航4</asp:LinkButton>
<asp:LinkButton ID="LinkButton5" runat="server" OnClick="LinkButton_Click">导航5</asp:LinkButton>

</asp:PlaceHolder>
<br />
<asp:LinkButton ID="LinkButton6" runat="server">其他LinkButton</asp:LinkButton>

CS文件加一个事件:
protected void LinkButton_Click(object sender, EventArgs e)
{
foreach (Control c in PlaceHolder1.Controls)
{
if (c is LinkButton)
{
(c as LinkButton).Enabled = true;
}
}
(sender as LinkButton).Enabled = false;
}

多个LinkButton导航

标签:

原文地址:http://www.cnblogs.com/hzxcms/p/4207553.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!