Open Bootstrap Modal Popup on Button Mouseover (Mouse Hover) using C# and VB.Net in ASP.Net

Last Reply 10 months ago By dharmendr

Posted 10 months ago


Is it possible to have a modal popup on mouseover event of a button in c#?

Please help me to implement the same.


You are viewing reply posted by: dharmendr 10 months ago.
Posted 10 months ago

Hi sat,

Check this example. Now please take its reference and correct your code.


<script type="text/javascript" src=''></script>
<script type="text/javascript" src=''></script>
<link rel="stylesheet" media="screen" href='' />
<script type="text/javascript">
    function ShowPopup() {
    <asp:Button ID="btnShowPopup" runat="server" Text="Show Popup" CssClass="btn btn-info btn-lg" />
<!-- Modal Popup -->
<div id="MyPopup" class="modal fade" role="dialog">
    <div class="modal-dialog">
        <!-- Modal content-->
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">
                <h4 class="modal-title">
                    Modal Title.
            <div class="modal-body">
                Modal Body.
            <div class="modal-footer">
                <button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
<!-- Modal Popup -->



protected void Page_Load(object sender, EventArgs e)
    // Assigned mouse hover event to Bitton.
    btnShowPopup.Attributes.Add("onmouseover", "ShowPopup();");


Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
    ' Assigned mouse hover event to Bitton.
    btnShowPopup.Attributes.Add("onmouseover", "ShowPopup();")
End Sub