Hi Friends,
I want to enter data in grid using popup. But when I try to load, it's not display popup. I have attached my cshtml code and mvc controller code here.
cshtml:
------------------------------------------------------------------------------
Controller:
I have also attached the screen shot which I got.
Please help me .
Thanks & Regards,
I want to enter data in grid using popup. But when I try to load, it's not display popup. I have attached my cshtml code and mvc controller code here.
cshtml:
@(Html.Kendo().Grid(Model.CustomerOrderDetails)
.Name("CustomerOrder")
.Columns(columns =>
{
columns.Bound(p => p.TransitionSN).Width(70);
columns.Bound(p => p.DateOfPurchase).Width(140);
columns.Bound(p => p.CustomerName).Width(140);
columns.Bound(p => p.BrandName).Width(140);
columns.Bound(p => p.Qty).Width(50);
columns.Command(command => { command.Edit(); command.Destroy(); }).Width(150);
}
)
.ToolBar(toolbar => toolbar.Create())
.Editable(editable => editable.Mode(GridEditMode.PopUp))
.Pageable()
.Sortable()
.Scrollable()
.DataSource(dataSource => dataSource
.Ajax()
.Events(events => events.Error("error_handler"))
.Model(model => model.Id(p => p.TransitionSN))
.Read(read => read.Action("NewCustomer_Read", "CustomerOrder"))
.Create(update => update.Action("NewCustomer_Create", "CustomerOrder"))
.Update(update => update.Action("NewCustomer_Create", "CustomerOrder"))
.Destroy(update => update.Action("NewCustomer_Create", "CustomerOrder")))
)
------------------------------------------------------------------------------
Controller:
public
ActionResult NewCustomer()
{
return
View(
new
NewCustomer { CustomerAddress =
""
, CustomerEmail =
""
, CustomerName =
""
, CustomerCode =
""
, CustomerOrderDetails = SQLOrder.SelectAll() });
//return View();
}
public
ActionResult NewCustomer_Read([DataSourceRequest] DataSourceRequest request)
{
return
Json(SessionNewCustomerRepository.All().ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
//return Json(SQLOrder.SelectAll().ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
}
[AcceptVerbs(HttpVerbs.Post)]
public
ActionResult NewCustomer_Create([DataSourceRequest] DataSourceRequest request, CustomerOrder.Models.OrderDetails newcustomer)
{
if
(newcustomer !=
null
&& ModelState.IsValid)
{
SessionNewCustomerRepository.Insert(newcustomer);
}
return
Json(
new
[] { newcustomer }.ToDataSourceResult(request, ModelState));
}
I have also attached the screen shot which I got.
Please help me .
Thanks & Regards,