局部视图未与模型绑定

时间:2019-02-18 08:46:42

标签: c# asp.net-mvc

我将主视图绑定到具有两个局部视图的自定义模型。一个局部视图绑定到调度模型,另一个局部视图绑定到相同的定制模型。

第二个局部视图在http发布中显示为空。

这是主视图

@model DBS.CustomVariable

<div id="divSchedule" style="display: none" align="left">
            @Html.Partial("_cron", new DBS.Schedule2())
            @Html.Partial("ScheduleEditPartial" ,Model)
</div>

视图模型是这样的

namespace DBS
{
    public class CustomVariable
    {
        public int ReportId { get; set; }

        public string ReportName { get; set; }

        public string ReportTypeId { get; set; }

        public string TemplateLocation { get; set; }

        public bool IsScheduled { get; set; }

        public int ScheduleID { get; set; }

        public string MailCC { get; set; }

        public string MailBCC { get; set; }

        public string MailSubject { get; set; }

        public string MailBody { get; set; }

        public string MailTo { get; set; }

        public bool Status { get; set; }

        public bool IsReportNameOverwrite { get; set; }

        public string NamingConvention { get; set; }

        public string FileAttribs { get; set; }

        public string[] DirectoryName { get; set; }

        public List<string> FolderName { get; set; }

        public string SavePath { get; set; }

        [RegularExpression("^[a-zA-Z][a-zA-Z0-9_]*$", ErrorMessage = "Please start with alphabets followed by alphanumeric or _.")]
        [StringLength(20)]
        public string FilePath { get; set; }

        public string DefaultLocation => ConfigurationManager.AppSettings["DefaultExcelReportSavePath"];

        public int ShareOption { get; set; }

        public string[] station_arr { get; set; }

        public string TemplateOriginalName { get; set; }
    }
}

控制者是这个

    [ValidateInput(false)]
    [System.Web.Mvc.HttpPost]
    [Authorize(Roles = "ExcelCreate")]
    [SessionExpireFilter]
    public ActionResult Create(FormCollection form, HttpPostedFileBase file, CustomVariable modelCustomVariable)
    {......}

我在控制器方法的customvariable中得到了空值。

我在哪里?

0 个答案:

没有答案