下拉单击服务器端
本文关键字:服务器端 单击 | 更新日期: 2023-09-27 17:51:15
我在导航栏(http://getbootstrap.com/components/#nav-dropdowns)内定义了一个下拉菜单,当我单击下拉菜单时,我想在服务器端执行一个函数。
我的下拉:
<li role="presentation" class="dropdown">
<a href="../#" id="notS" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
<span class="glyphicon glyphicon-bell" aria-hidden="true"><span id="not" class="badge">3</span></span>
</a>
<ul id="notificacoes" class="dropdown-menu" role="menu">
<li role="presentation">
<a runat="server" onserverclick="setVisivel" role="menuitem" tabindex="-1" href="../Admin/VerRevisoes?id=1144">
As revisões do caso 1144 estão completas
</a>
</li>
<li role="presentation">
<a runat="server" onserverclick="setVisivel" role="menuitem" tabindex="-1" href="../Admin/VerRevisao?id=7">
Foi adicionada uma nova revisão ao caso 1144
</a>
</li>
<li role="presentation">
<a runat="server" onserverclick="setVisivel" role="menuitem" tabindex="-1" href="../Admin/Casos">
O caso 1145 foi adicionado pelo utilizador 1
</a>
</li>
</ul>
</li>
我的函数setVisivel是c#,它在服务器端:
protected void setVisivel(object sender, EventArgs e)
{
DBConFactory.getInstance().setVisibleNotificacao(int.Parse(Context.User.Identity.GetUserName()));
}
但是当我点击下拉菜单时,函数setVisivel没有被调用!
请确保您已经设置了ASP的属性。. NET下拉控件:AutoPostBack="True"
(如MSDN online中所解释的:https://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.listcontrol.autopostback%28v=vs.110%29.aspx)
<asp:DropDownList ID="cmbSelectChannel" runat="server" AutoPostBack="true"/>
希望这能有所帮助。最好的祝福,
在我看来;尝试整合两种不同的技术。net和bootstrap,就像其他人以前尝试过的那样。
试着读这个:http://techbrij.com/responsive-menu-twitter-bootstrap-asp-net
然后修改你的引导CSS,使它看起来像你的下拉菜单现在的样子