Ramco Ramco

Ramco Ramco

  • 443
  • 3.4k
  • 526.6k

Dynamic Modal PopUp

Aug 23 2024 9:10 AM

Hi

  I want to define below code at only 1 place. Asof now i am writing it in each form. How it can be done through User Control . I have i User Control whose code is 

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="MBox.ascx.cs" Inherits="Payroll.MBox" %>

<script type="text/javascript">

    var swalInit = swal.mixin({
        buttonsStyling: false,
        confirmButtonClass: 'btn btn-primary',
        cancelButtonClass: 'btn btn-light'
    });

    

    function ShowPopup_Redirect(heading, body, type, url) {
        swalInit.fire({
            title: heading,
            text: body,
            type: type,
            position: 'top',
            allowOutsideClick: false,
        });
    }
</script>
<div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title">
                    <asp:Label ID="ltrlDelHead" Text="Are You Sure, You want to Delete This?" runat="server"></asp:Label></h5>
                <button type="button" class="bootbox-close-button close" data-dismiss="modal" aria-hidden="true">×</button>
            </div>
            <div class="modal-body">
                <div class="bootbox-body">
                    <div class="bootbox-form">
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-link" data-dismiss="modal">Cancel</button>
                <asp:LinkButton ID="lnkRecordDelete" class="btn bg-danger" runat="server" OnClick="lnkRecordDelete_Click">Delete</asp:LinkButton>
            </div>
        </div>
    </div>
</div>

Answers (4)