这是我的观点....此表单提交无效,我想在点击".Create(update => update.Action("EditingInline_Create", "SemesterRegistation"))"
时将文本框数据发送到Controller ...请提供任何解决方案
@using (Html.BeginForm("EditingInline_Create", "SemesterRegistation", FormMethod.Post, new { id="formID"}))
{
<input type="text" id="tags" name="tags" />
@(Html.Kendo().Grid((IEnumerable<SIMS.Models.Semester.SemesterRegistationModel>)Model.lis_semester_registration)
.Name("grid")
.Columns(columns =>
{
columns.Bound(o => o.SemesterID).Visible(false);
columns.ForeignKey(p => p.AcadamiYear, (System.Collections.IEnumerable)ViewData["acadamicyear"], "Value", "Text")
.Title("Acadamic Year");
columns.ForeignKey(p => p.AcadamicSemester, (System.Collections.IEnumerable)ViewData["acadamicsemester"], "Value", "Text")
.Title("Acadamic Semester");
columns.ForeignKey(p => p.IntakeID, (System.Collections.IEnumerable)ViewData["IntakeID"], "IntakeID", "IntakeCode")
.Title("Intake");
columns.Bound(o => o.From).Title("From").Format("{0:dd/MM/yyyy}").EditorTemplateName("Date");
columns.Bound(o => o.To).Title("To").Format("{0:dd/MM/yyyy}").EditorTemplateName("Date");
columns.ForeignKey(p => p.ProgrammeID, (System.Collections.IEnumerable)ViewData["Programme"], "Id", "DegreeName")
.Title("Programme");
columns.ForeignKey(p => p.SpecializationID, (System.Collections.IEnumerable)ViewData["Specialzation"], "SpecializationID", "SpecializationNameID")
.Title("Specialzation").EditorTemplateName("SpecialzationID");
columns.Command(command => { command.Edit(); }).Width(182);
})
.ToolBar(toolbar => toolbar.Create())
.Editable(editable => editable.Mode(GridEditMode.PopUp).TemplateName("DetailSemester").Window(w => w.Width(850)))
.Selectable()
.Pageable()
.Sortable()
.Groupable()
.Filterable()
//.Events(e => e.DataBound("onDataBound"))
.ToolBar(toolbar =>
{
toolbar.Template(@<text>
<div class="toolbar">
<a href="/SemesterRegistation/EditingInline_Read?grid-mode=insert" class="k-button k-button-icontext k-grid-add">
<span class="k-icon k-add"></span>Add New Record
</a>
</div>
</text>);
})
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(50)
.Events(events => events.Error("error_handler"))
.Model(model => { model.Id(p => p.SemesterID); })
.Create(update => update.Action("EditingInline_Create", "SemesterRegistation"))
.Read(read => read.Action("EditingInline_Read", "SemesterRegistation"))
.Update(update => update.Action("EditingInline_Update", "SemesterRegistation"))
)
.Resizable(resize => resize.Columns(true))
)
//My Controller is here..In here "subjectids" always null...But I want to get text box value to "subjectids"....
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult EditingInline_Create([DataSourceRequest] DataSourceRequest request, SemesterRegistationModel model)
{
string subjectids = Request.Form["tags"];//model.hdnIds;//;
if (model != null && ModelState.IsValid)
{
repSem = new SemesterRegistationRepository();
bool res = repSem.Create(model,subjectids);
}
return Json(new[] { model }.ToDataSourceResult(request, ModelState));
}
答案 0 :(得分:-2)
我使用java脚本解决了这个问题:
.Create(update => update.Action("EditingInline_Create", "SemesterRegistation").Data("loadMethos"))
此文本框的返回值
function loadMethos() { return { tags: $('#tags').val() }; }