简体   繁体   中英

LinkButton OnClick event does not fire in Bootstrap drop-down menu

I am developing an ASP.Net application. I have implemented a Bootstrap Navbar. Everything is working as expected except when I try to implement an <asp:LinkButton> inside on of the dropdown-menu 's.

Here's a snippet:

<ul class="dropdown-menu">
    <li>
        <asp:LinkButton ID="btnLogout" runat="server" OnClick="btnLogout_Click">
            Log out
        </asp:LinkButton>
    </li>
</ul>

Basically this Log out LinkButton is a drop-down menu item. When I run the application and click it, all it does is toggle the drop-down menu to close again.

I've set a break point in the btnLogout_Click event but it never gets reached which indicates the event is never fired.

Is there anyway to make this LinkButton 's OnClick event fire properly?

Note: It works if I double click (ie click it again before it fully closes). But this is not ideal for the UX.

<ul class="dropdown-menu" role="menu">
<li>
    <asp:LinkButton ID="btnLogout" runat="server" OnClick="btnLogout_Click">
        Log out
    </asp:LinkButton>
</li>

Try this

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM