Hi, I need to send in a bunch of form values to the create method (add new button) on the grid.
For edit, I used like this and it works fine.
grid call:
.Read(read => read.Action("Read_FinesByMLS", "FinesHistoryByMLS").Data("ParameterData"))
js function:
function ParameterData() {
alert("para=" + $("#MLSNumber").val());
return {
MLSNumber: $("#MLSNumber").val()
}
}
controller function:
public ActionResult Read_FinesByMLS([DataSourceRequest] DataSourceRequest request, string MLSNumber)
{
using (var context = new MATRIXEntities_Connection ())
{
IQueryable<FineHistory> finebymls = context.FineHistories;
if (MLSNumber != null)
{
finebymls = finebymls.Where(f => f.MLSNumber == MLSNumber); }
DataSourceResult result = finebymls.ToDataSourceResult(request, f => new FineHistoryViewModel
{
FineHistoryId = f.FineHistoryId ,
FineCode = f.FineCode,
});
return Json(result);
}
}
When I tried to do same for create, I am not getting any value for the parameter in the controller function. MLSNumber param is coming null. Any help is appreciated. Thanks
here is my create action call.
.Create(create => create.Action("Create_FinesByMLS", "FinesHistoryByMLS").Data("ParameterData"))
Its the same function call as above for edit function.
Controller function.
public ActionResult Create_FinesByMLS([DataSourceRequest] DataSourceRequest request, string MLSNumber)
{
using (var objFines_Context = new MATRIXEntities_Connection())
{
*/
//objFines_Context.usp_InsertFineHistory("211131297", "479", 4790, "713779DAF4844A", "239024", "281530", "kmantrip", "M");
//objFines_Context.SaveChanges();
}
return View();
}
the parameter is