Open Closed

Attempting to Pass Information into a Modal and Modal Manager is Giving Me Trouble #10588

dev1_premierpoint created

Product version: ASP.NET Zero v9.1 Product type: MVC & jQuery Product framework type: .NET Core

I am trying to pass information into a modal (a UUID in order to lookup an object once I have the modal open and an integer that is actually a language code), and I'm not sure if there is an interaction with the modalManager that is used to create these modals that is preventing more standard methods of passing information from working or if I have some other problem.

I've tried having hidden fields on the page that I populate by trying to set the value of those fields in the on click method. example: $('#btnCreateNewLabel').on('click', async function () { $(".modal-body #syncPointId").val(syncPointID); .... With #syncPointId being one of the fields on the modal in this example. This method never seems to pass anything into the modal.

I've tried something similar with the on '' event example: $('#CreateOrEditLabelModal').on('', function (e) { $(e.currentTarget).find('input[name="syncPointId"]').val(syncPointID)

I guess I am wondering if there is a method that works better with the ModalManager that I am unaware of or if there is an issue with my setup.

Something that may be important to note is that the page is already currently in a modal when I am trying to pass this information into another smaller modal.

2 Answer(s)
  • 0
    ismcagdas created
    Support Team


    You can pass it like below to your modal open action{ id: 42 });

    Then, you can handle it on the controller and pass back to Modal's cshtml file;

    public async Task<PartialViewResult> CreateOrEditModal(int? id)
        var viewModal = new YourModel(){Id = id};
        return PartialView("_Modal", viewModal);
  • 0
    dev1_premierpoint created

    Appreciate the help. It was challenging to find information online about this one. Quite of few examples of more standard modal usage, but no examples that worked with the boilerplate you've got going on here.