Ramco Ramco

Ramco Ramco

  • 434
  • 3.4k
  • 556.8k

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>
JavaScript
<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>
C#

Answers (4)

0
Shweta Lodha

Shweta Lodha

  • 20
  • 48.5k
  • 4.2m
Mar 30 2014 11:52 PM
You can take below approach:
First create Country class that would contain country related information and all available city values in a collection. Somewhere in your code, instantiate a collection of the country and the corresponding cities.

In XAML, bind the ItemSource property of the combobox to that property. For 2nd combobox, bind it's ItemSource property to the list of cities from the SelectedItem of the first combobox.

Hope it will resolve your linking issue.
Accepted Answer
0
Shweta Lodha

Shweta Lodha

  • 20
  • 48.5k
  • 4.2m
Mar 30 2014 11:57 PM
Let me know, in case if you get stuck somewhere.
0
Sukaskha

Sukaskha

  • 0
  • 113
  • 20.6k
Mar 30 2014 11:57 PM
Shweta Lodha,
I'll give a try to this approach. Thanks for your suggestion.