弹出控件在另一个区域中引用时无法调用ajax调用。 [英] Popup Control is not able to invoke ajax call when referenced in another area.

查看:70
本文介绍了弹出控件在另一个区域中引用时无法调用ajax调用。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的,



我的问题在于应用程序设计。我们使用区域来模块化我们的中等规模应用。当我们得到一个需要动作或视图被执行但位于不同区域的用例时,就会出现问题。例如,我们在合同区 - >搜索合同清单。此列表包含加载合同更新屏幕的操作。这工作正常,但是当我们想要从任务 - >我的任务 - >更新合同加载相同的更新屏幕时,它失败了。下面是一个场景



我们成功地能够在客户端使用CallbackRouteValues = new {Controller =Variation,Action =GetAddEditVariationForm}在以下结构中呈现Popup控件一边。



Root

| __Area

| ___合同

| ____控制器

| ___ VarController

| ___ ConController

| ____视图

| __Shared

| | ____ PopupControl(Controller = VarController,Action = MyAction} _PopUpAddEditVariation.cshtml

| __Con

| ___ Index.cshtml(@ Html.Partial(〜/ Areas / Contract / Views /Shared/_PopUpAddEditVariation.cshtml,型号)

| __Var

| ___ Index.cshtml(@ Html.Partial(〜/ Areas / Contract / Views / Shared / _PopUpAddEditVariation.cshtml,型号)



但是如果我们尝试从另一个区域渲染相同的弹出窗口,则不会提出回调。



Root

| __Area

| ___合同

| | ____控制器

| | | ___ VarController

| | | ___ ConController

| | ____视图

| | __Shared

| | | ____ PopupControl( Controller = VarController,Action = MyAction} _PopUpAddEditVariation.cshtml

| | __Con

|

| ___ Index.cshtml

(@ Html.Partial(〜/ Areas / Contract / Views / Shared / _PopUpAddEditVariation.cshtml,

型号)

| | __Var

|

| ___ Index.cshtml

(@ Html.Partial(〜/ Areas / Contract / Views / Shared / _PopUpAddEditVariation.cshtml,

Model )

|

| __Tasks

| ___控制器

| | ___ TaskController

| ___视图

| __Index.cshtml(@ Html.Partial(〜/ Areas / Contract / Views / Shared / _PopUpAddEditVariation.cshtml,

型号)



可能是什么原因以及如何修复它?在目前的情况下,我们通常做的是复制所有代码和过去到Task->查看文件夹并在TaskController文件夹中复制VarController代码这绝对是一个坏主意。请指导我们



问候,

Asif

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

推荐答案

我已经通过在Callbackroute中添加
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" };


这篇关于弹出控件在另一个区域中引用时无法调用ajax调用。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆