Product version: ASP.NET Zero v9.1 Product type: MVC & jQuery Product framework type: .NET Core
I am trying to put a handmade CreateAndEditModal inside of a pregenerated one for one of our RAD tool created entities. Similar to how the default C&E modal is loaded from some form of create new button on the index page, I have a create button that is meant to open up my new modal. when I attempt to open it up however I get a 404 error in the console.
This is the section in the js file where I am declaring the modal: var _createOrEditLabelModal = new app.ModalManager({ viewUrl: abp.appPath + 'App/SyncPoints/CreateOrEditLabelModal', scriptUrl: abp.appPath + 'view-resources/Areas/App/Views/SyncPoints/_CreateOrEditLabelModal.js', modalClass: 'CreateOrEditLabelModal', modalSize:'modal-m' });
And this is the how the original modal is declared in the javaScript of the index page: var _createOrEditModal = new app.ModalManager({ viewUrl: abp.appPath + 'App/SyncPoints/CreateOrEditModal', scriptUrl: abp.appPath + 'view-resources/Areas/App/Views/SyncPoints/_CreateOrEditModal.js', modalClass: 'CreateOrEditSyncPointModal', modalSize: 'modal-xl' });
The files are in the same folders, so I don't think I messed up the paths in the declaration.
3 Answer(s)
-
0
Hi,
The problem might be related to CreateOrEditLabelModal action. Could you share your SyncPoints controller ?
Thanks,
-
0
I thought there might be another file I needed to edit. There doesn't seem to be anything here for the new modal.
using System; using System.Threading.Tasks; using Abp.AspNetCore.Mvc.Authorization; using Microsoft.AspNetCore.Mvc; using Pol.Web.Areas.App.Models.SyncPoints; using Pol.Web.Controllers; using Pol.Authorization; using Pol.TermSync; using Pol.TermSync.Dtos; using Abp.Application.Services.Dto; using Abp.Extensions;
namespace Pol.Web.Areas.App.Controllers { [Area("App")] [AbpMvcAuthorize(AppPermissions.Pages_SyncPoints)] public class SyncPointsController : PolControllerBase { private readonly ISyncPointsAppService _syncPointsAppService;
public SyncPointsController(ISyncPointsAppService syncPointsAppService) { _syncPointsAppService = syncPointsAppService; } public ActionResult Index() { var model = new SyncPointsViewModel { FilterText = "" }; return View(model); } [AbpMvcAuthorize(AppPermissions.Pages_SyncPoints_Create, AppPermissions.Pages_SyncPoints_Edit)] public async Task<PartialViewResult> CreateOrEditModal(string id) { GetSyncPointForEditOutput getSyncPointForEditOutput; if (!id.IsNullOrWhiteSpace()){ getSyncPointForEditOutput = await _syncPointsAppService.GetSyncPointForEdit(new EntityDto<string> { Id = (string) id }); } else { getSyncPointForEditOutput = new GetSyncPointForEditOutput{ SyncPoint = new CreateOrEditSyncPointDto() }; getSyncPointForEditOutput.SyncPoint.lastRun = DateTime.Now; } var viewModel = new CreateOrEditSyncPointModalViewModel() { SyncPoint = getSyncPointForEditOutput.SyncPoint, }; return PartialView("_CreateOrEditModal", viewModel); } public async Task<PartialViewResult> ViewSyncPointModal(string id) { var getSyncPointForViewDto = await _syncPointsAppService.GetSyncPointForView(id); var model = new SyncPointViewModel() { SyncPoint = getSyncPointForViewDto.SyncPoint }; return PartialView("_ViewSyncPointModal", model); } }
}
I guess that I need a new task here for the new modal?
-
0
Hi,
Yes, you need to create a new action named
CreateOrEditLabelModal
in SyncPointsController and return the correct view.