-1
我需要獲得當前的模型(以局部視圖)連接到控制器分析模型,通過對按鍵的局部視圖控制單擊
我使用下面的代碼,但不工作。
var model = function() {
return @Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(Model)); }();
$.ajax({
url: "@Url.Action("AddSchedule1DynamicRow")",
type: "POST",
data: JSON.stringify(model),
contentType: "application/json; charset=utf-8",
dataType: "json",
error: function (response) {
alert(response.responseText);
},
success: function (response) {
$(id).append(model);
attachExpandEvent();
readonlyControlsSchedule1();
getDescriptionSchedule1();
}
});
控制器
[HttpPost]
public ActionResult AddSchedule1DynamicRow([System.Web.Http.FromBody]CITMainReturnModel model)
{
ViewData.TemplateInfo.HtmlFieldPrefix = CTConstants.ScheduleModelName.Schedule1Model;
//model = new CITSchedule01Model(6);
if (model.Schedule1Model != null)
{
model.Schedule1Model.ListSubSchedule1Model.Add(new CITSubSchedule01Model());
return PartialView("_Schedule1DynamicList", model);
}
return PartialView("_Schedule1DynamicList", new CITSchedule01Model(6));
}
是什麼點發回剛剛發送到視圖的服務器服務器的相同型號。 –
這是用於綁定動態文本框的_Schedule1DynamicList部分視圖 –