Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Example of how to pass variable/object to modal view? #3287


User avatar
0
mikemey01 created

Hi - I would like to use the same cshtml file to add and edit items. I can create the empty modal no problem but what about passing @Model values to the modal when editing? I don't quite understand how to pass variables/objects to the closure function either directly or using the modalmanager.

Is there an example of how this is done?

Thanks,

Mike


1 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    You can pass values like we did here <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero/blob/dev/src/MyCompanyName.AbpZeroTemplate.Web/Areas/Mpa/Views/Users/Index.js#L70">https://github.com/aspnetzero/aspnet-ze ... dex.js#L70</a>.

    For editing we only pass Id value and get record from db on the server and pass model to view model <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero/blob/dev/src/MyCompanyName.AbpZeroTemplate.Web/Areas/Mpa/Controllers/UsersController.cs#L68">https://github.com/aspnetzero/aspnet-ze ... ler.cs#L68</a>

    Thanks.