Click here to Skip to main content
15,898,825 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Dear All,

My problem lies in the application design. We have used Areas to modularize our medium scale application. The problem comes when we get a usecase which requires an action or view to get executed but residing in a different areas. For example we are in Contract area -> Search contract list. This list contains an action that loads contract update screen. This works fine but the moment we would like to load the same update screen from Task->My Task->Update contract, it fails. Below is a scenario

we are successfully able to render Popup control in following structure using CallbackRouteValues = new { Controller = "Variation", Action = "GetAddEditVariationForm" } at client side.

Root
|__Area
|___Contract
|____Controller
|___VarController
|___ConController
|____Views
|__Shared
| |____PopupControl ( Controller=VarController,Action=MyAction} _PopUpAddEditVariation.cshtml
|__Con
|___Index.cshtml (@Html.Partial("~/Areas/Contract/Views/Shared/_PopUpAddEditVariation.cshtml", Model)
|__Var
|___ Index.cshtml (@Html.Partial("~/Areas/Contract/Views/Shared/_PopUpAddEditVariation.cshtml", Model)

But if we try to render the same popup from another area it is not raising ajax call back.

Root
|__Area
|___Contract
| |____Controller
| | |___VarController
| | |___ConController
| |____Views
| |__Shared
| | |____PopupControl ( Controller = VarController, Action = MyAction} _PopUpAddEditVariation.cshtml
| |__Con
|
|___Index.cshtml
(@Html.Partial("~/Areas/Contract/Views/Shared/_PopUpAddEditVariation.cshtml",
Model)
| |__Var
|
|___ Index.cshtml
(@Html.Partial("~/Areas/Contract/Views/Shared/_PopUpAddEditVariation.cshtml",
Model)
|
|__Tasks
|___Controller
| |___TaskController
|___Views
|__Index.cshtml (@Html.Partial("~/Areas/Contract/Views/Shared/_PopUpAddEditVariation.cshtml",
Model)

What could be the reason and how am i going to fix it? In current situation what we usually do is to copy all the code and past to Task->View folder and copy VarController code in the TaskController folder which is insanely a bad idea. Please guide us

Regards,
Asif
Posted

1 solution

I have resolved it by adding
Area = "Contract",
in Callbackroute as shown below. This is just for the reference

settings.CallbackRouteValues = new { Area = "Contract", Controller = "Variation", Action = "GetAddEditVariationForm" };
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900