Click here to Skip to main content
16,017,857 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How to call bootstrap modalpopup in usercontrol ? (or) How to cal bootstrap modal popup in .aspx page not masterpage in asp.net.

What I have tried:

How to call bootstrap modalpopup in usercontrol ?
Posted
Updated 4-Apr-23 11:08am

1 solution

Consider This being your Modal with some controls being inside of it:
C#
<div id="modal" modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal">×
                    </button>
                    <h4 class="modal-title">Register Form</h4>
                </div>
                <div class="modal-body">
                    <asp:Label runat="server"  Text="Enter  UserName"></asp:Label>
                    <asp:TextBox runat="server" class="form-control" ID="txtUserReg">
                    </asp:TextBox>
                    <br />
                    <br />
                 
                    <asp:TextBox runat="server" TextMode="Password" ID="txtPassReg">
                    </asp:TextBox>
                </div>
                <div class="modal-footer">
                    <asp:Button  ID="btnSave" Text="Save" OnClick="Register_Click" 
                     runat="server" />
                </div>
</div>

You have to Create a button or a control that on click you will Show your modal or on some sort of event..
If you want to make the modal pop up the you have to use some javascript:
JavaScript
   <pre><script>
    $(document).ready(function () {
        $("#Button1").click(function () {
            $("#modal").show(300);
            $(".showHideModal").show();
        });

        $(".showHideModal").click(function () {
            $("#modal").hide(300);
            $(".showHideModal").hide();
        });
    });
</script>

I Hope this will help you Out!!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900