传递到字典中的模型项的类型为'devexpress.dashboardweb.workingmode',但此字典需要类型的模型项 [英] The model item passed into the dictionary is of type 'devexpress.dashboardweb.workingmode', but this dictionary requires a model item of type
问题描述
我收到错误'
The model item passed into the dictionary is of type 'DevExpress.DashboardWeb.WorkingMode', but this dictionary requires a model item of type
'的模型项按钮点击弹出部分视图。
这里我在index.cshtml视图页面中拍摄了三个部分视图。
三个部分视图有不同的模型。
在弹出内容中,我调用另一个表单的部分视图。
我创建了元组,其中我定义了两个模型,但仍然有相同的错误。
请建议我。
我尝试过:
index.cshtml
' on rendering partial view in popup on button click.
Here I have taken three partial views in index.cshtml view page.
Three partial views have different models.
In the popup content i am calling partial view of another form.
I have created tuple in which i defined two models but still got the same error.
Please suggest me.
What I have tried:
index.cshtml
@model Tuple<DevExpress.DashboardWeb.WorkingMode, DashboardDemo.Models.vw_100_QUERY_FOR_XLS_WEEK_IN_PROGRESS_016_Forecast_Follow_Current_Data>
@Html.Partial("~/Views/Home/DashboardPartial.cshtml")
@*</div>*@
@*<div style="position: absolute; left:0px;top:40px;right:350px;bottom:0;
height: 100%;
">*@
@(Html.DevExpress().PopupControl(settings =>
{
settings.Name = "PopupControlSelectSub";
settings.ShowOnPageLoad = false;
settings.ShowMaximizeButton = true;
settings.Width = 1200;
settings.Height = 900;
settings.CallbackRouteValues = new { Controller = "Home", Action = "Main_Menu" };
settings.AllowDragging = true;
settings.CloseAction = CloseAction.CloseButton;
settings.PopupAnimationType = AnimationType.Slide;
settings.HeaderText = "Main Menu";
settings.Modal = true;
settings.PopupHorizontalAlign = PopupHorizontalAlign.WindowCenter;
settings.PopupVerticalAlign = PopupVerticalAlign.WindowCenter;
settings.PopupElementID = "btnName_CD";
settings.ScrollBars = ScrollBars.Horizontal;
settings.SetContent(() =>
{
Html.RenderPartial("Main_Menu");
});
}).GetHtml())
@Html.Partial("~/Views/TreeView/VirtualModePartial.cshtml")
@Html.Partial("~/Views/Home/ForecastGridPartial.cshtml")
Main_Menu.cshtml
Main_Menu.cshtml
@model DashboardDemo.Models.vw_100_QUERY_FOR_XLS_WEEK_IN_PROGRESS_016_Forecast_Follow_Current_Data
<link href="~/Content/ForbiddenZones.css" rel="stylesheet" />
<script src="@Url.Content("~/Content/scripts.js")" type="text/javascript"></script>
@{
ViewBag.Title = "Main Menu";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<h2>Main Menu</h2>
@Html.DevExpress().DockPanel(
settings =>
{
settings.Name = "panel1";
settings.PanelUID = "panel1";
settings.HeaderText = "Requester's Perimeter";
settings.VisibleIndex = 0;
settings.Width = 200;
settings.Height = 200;
settings.ShowHeader = true;
settings.ShowCloseButton = false;
settings.AllowResize = true;
settings.OwnerZoneUID = "leftZone";
settings.Styles.Content.Border.BorderStyle = BorderStyle.Solid;
settings.Styles.Content.Border.BorderWidth = 1;
settings.Styles.Content.Border.BorderColor = Color.FromArgb(0xBBD7E7);
settings.Styles.Content.BackColor = Color.FromArgb(0xDBEBF4);
settings.Styles.Content.Paddings.Padding = 0;
settings.SetContent(() =>
{
@Html.DevExpress().Label(
s =>
{
s.Name = "Label1";
s.Text = "Req Section:";
}
).GetHtml();
@Html.DevExpress().ComboBox(
q =>
{
q.Name = "ddl_Req_Section";
//q.Properties.DataSource = AINIPMKPIDashboard.Models.MainMenu.GetRequiredSelection();
//q.CallbackRouteValues = new { Controller = "Home", Action = "Main_Menu", id = localvar };
q.Properties.ValueField = "txt_Req_Section";
q.Properties.TextField = "txt_Req_Section";
q.Properties.ValueType = typeof(string);
q.Properties.NullText = "All";
q.Properties.DropDownStyle = DropDownStyle.DropDown;
}
).BindList(ViewBag.GetReqsellist).Bind(Model.txt_Req_Section).GetHtml();
@Html.DevExpress().Label(
a =>
{
a.Name = "Label2";
a.Text = "Req IPT:";
}
).GetHtml();
@Html.DevExpress().ComboBox(
b =>
{
b.Name = "ddl_Req_IPT";
}
).GetHtml();
}
推荐答案
Html.RenderPartial("Main_Menu");
你没有给部分视图一个模型,所以(我认为)它使用父元组的模型,但是Main_Menu需要vw_100_QUERY_FOR_XLS_WEEK_IN_PROGRESS_016_Forecast_Follow_Current_Data。试试类似
You're not giving the partial view a model so (I think) it uses the model of the parent which is your Tuple, however Main_Menu needs vw_100_QUERY_FOR_XLS_WEEK_IN_PROGRESS_016_Forecast_Follow_Current_Data. Try something like
Html.RenderPartial("Main_Menu", Model.Item2);
将父模型的...._ Current_Data部分作为自己的模型传递给局部视图。
that will pass the ...._Current_Data part of the parent model to the partial view as its own model.
这篇关于传递到字典中的模型项的类型为'devexpress.dashboardweb.workingmode',但此字典需要类型的模型项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!