Asp.net mvc 4 通过选择弹出标题移动弹出位置时,弹出内容不会变为空白

Asp.net mvc 4 通过选择弹出标题移动弹出位置时,弹出内容不会变为空白,asp.net-mvc-4,popup,devexpress,Asp.net Mvc 4,Popup,Devexpress,我使用popup的ContentUrl属性将视图打开到popup控件中。 但是当我试图通过选择popup header来移动popup的位置时。当我移动或选择弹出标题时,弹出内容不会变为空白。在线提供的DevXpress演示中也存在同样的问题 我参考了下面的devexpress弹出控件演示 我已经编写了以下代码 家庭控制器 public class HomeController : Controller { public ActionResult SendProduc

我使用popup的ContentUrl属性将视图打开到popup控件中。 但是当我试图通过选择popup header来移动popup的位置时。当我移动或选择弹出标题时,弹出内容不会变为空白。在线提供的DevXpress演示中也存在同样的问题

我参考了下面的devexpress弹出控件演示

我已经编写了以下代码 家庭控制器

public class HomeController : Controller
    {

        public ActionResult SendProduct(string rowId)
        {
            Product objProduct = new Product();
            return View(objProduct);
        }

        [HttpPost]
        public ActionResult SendProduct(Product objProduct)
        {
            return View(objProduct);
        }
    }
产品模型

public class Product
{
    public int ProductId { get; set; }

    [Required]
    public string Name { get; set; }
}
Index.chtml

   @{
    ViewBag.Title = "Home Page";
}
@using DevExpress.Web.Mvc.UI
@using DevExpress.Web.ASPxGridView
@using UI.Infrastructure.Resources;
<script type="text/javascript">
    function OnBeginCallback(s, e) {
        e.customArgs["rowId"] = 123;
    }
    function Click() {
        pcSendProduct.PerformCallback();
        if (!pcSendProduct.IsVisible())
            pcSendProduct.Show();
    }
</script>

<a href="javascript:Click()">Enumalate menu click</a>
<div>
   @Html.DevExpress().Button(settings =>
                                   {
                                       settings.Name = "btnSend";
                                       settings.Width = 80;
                                       settings.Text = "Find";
                                       settings.UseSubmitBehavior = false;
                                       settings.ClientSideEvents.Click = string.Format("function(s, e) {{ Click(); }}");
                                   }).GetHtml()
</div>
  @Html.DevExpress().PopupControl(
    settings =>
    {
        settings.Name = "pcSendProduct";
        settings.Width = 1050;
        settings.Height = 550;
        settings.HeaderText = "Plan Customer Interaction";
        settings.CloseAction = DevExpress.Web.ASPxClasses.CloseAction.CloseButton;
        settings.Styles.Header.HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Center;
        settings.Styles.Header.VerticalAlign = System.Web.UI.WebControls.VerticalAlign.Middle;
        settings.Styles.Header.Font.Size = 10;
        settings.Modal = true;
        settings.ShowHeader = true;
        settings.ShowCloseButton = true;
        settings.CloseAction = DevExpress.Web.ASPxClasses.CloseAction.CloseButton;
        settings.Left = 1245;
        settings.Top = 300;
        settings.Styles.ModalBackground.BackColor = System.Drawing.Color.Transparent;
        //settings.ContentUrl = Url.Action("SendProduct", "Home");
        settings.ShowLoadingPanel = true;
        settings.ClientSideEvents.BeginCallback = "OnBeginCallback";
    }).GetHtml()
@{
ViewBag.Title=“主页”;
}
@使用DevExpress.Web.Mvc.UI
@使用DevExpress.Web.ASPxGridView
@使用UI.Infrastructure.Resources;
开始回调时的函数(s、e){
e、 customArgs[“rowId”]=123;
}
函数单击(){
pcSendProduct.PerformCallback();
如果(!pcSendProduct.IsVisible())
pcSendProduct.Show();
}
@Html.DevExpress()按钮(设置=>
{
settings.Name=“btnSend”;
设置。宽度=80;
settings.Text=“Find”;
settings.UseSubmitBehavior=false;
settings.ClientSideEvents.Click=string.Format(“函数(s,e){{{Click();}}”);
}).GetHtml()
@Html.DevExpress().PopupControl(
设置=>
{
settings.Name=“pcSendProduct”;
设置。宽度=1050;
设置。高度=550;
settings.HeaderText=“计划客户互动”;
settings.CloseAction=DevExpress.Web.ASPxClasses.CloseAction.CloseButton;
settings.Styles.Header.HorizontalAlign=System.Web.UI.WebControl.HorizontalAlign.Center;
settings.Styles.Header.VerticalAlign=System.Web.UI.WebControl.VerticalAlign.Middle;
settings.Styles.Header.Font.Size=10;
settings.Modal=true;
settings.ShowHeader=true;
settings.ShowCloseButton=true;
settings.CloseAction=DevExpress.Web.ASPxClasses.CloseAction.CloseButton;
设置。左=1245;
设置。Top=300;
settings.Styles.ModalBackground.BackColor=System.Drawing.Color.Transparent;
//settings.ContentUrl=Url.Action(“SendProduct”、“Home”);
settings.ShowLoadingPanel=true;
settings.ClientSideEvents.BeginCallback=“OnBeginCallback”;
}).GetHtml()
SendProduct.cshtml

@model Demo.Models.Product
@{
    ViewBag.Title = "SendProduct";
}

<h2>SendProduct</h2>

@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)

    <fieldset>
        <legend>Product</legend>

        @Html.HiddenFor(model => model.ProductId)

        <div class="editor-label">
            @Html.LabelFor(model => model.Name)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Name)
            @Html.ValidationMessageFor(model => model.Name)
        </div>

        <p>
            <input type="submit" value="Save" />
        </p>
    </fieldset>
}

<div>
    @Html.ActionLink("Back to List", "Index")
</div>

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
@model Demo.Models.Product
@{
ViewBag.Title=“SendProduct”;
}
SendProduct
@使用(Html.BeginForm()){
@Html.ValidationSummary(true)
产品
@Html.HiddenFor(model=>model.ProductId)
@LabelFor(model=>model.Name)
@EditorFor(model=>model.Name)
@Html.ValidationMessageFor(model=>model.Name)

} @ActionLink(“返回列表”、“索引”) @节脚本{ @Scripts.Render(“~/bundles/jqueryval”)
在上面的代码中,当我点击按钮popup时,在brouser上正确打开。但是当我选择popup header以更改位置或任何原因时,popup containt将被取消显示,或者popup将显示空白containt。当我取消选择popup header时,popup containt将在popup上显示

请给我一个解决方案,这样当用户选择popup header时,popup containt将不会变为空白。popup必须显示视图。

六年前,devexress团队解释说,使用ContentUrl属性是不可能的,因为控件在iframe中呈现它

您可以在ViewContext中写入视图内容,但控制器应返回PartialView

public class HomeController : Controller
{
    public ActionResult SendProduct(string rowId)
    {
        Product objProduct = new Product();
        return PartialView(objProduct);
    }

    [HttpPost]
    public ActionResult SendProduct(Product objProduct)
    {
        return PartialView(objProduct);
    }
 }
弹出设置

    settings.SetContent(() =>
    {
        ViewContext.Writer.Write((Html.Action("SendProduct", "Home").ToHtmlString()));
    });
    //settings.ContentUrl = Url.Action("SendProduct", "Home");

我在我的项目中复制了您的PopupControl设置,但在Chrome和IE11中未发现该行为。您是否注册了所有的DevExpress样式和脚本(Html.DevExpress().GetStyleSheets和GetScripts)?感谢您错误回复我已对设置进行了评论。ContentUrl=Url.Action(“SendProduct”,“Home”);代码进入弹出窗口,因此请取消注释该代码以打开弹出窗口中的视图。之后,您将获得blan containt条件。现在我复制了它。我解释了为什么会发生这种情况。