Hi Telerik,
I built a Kendo Grid that DataSourced from an EF model, which comes from a database view.
We're using stored procedures (mapped as Function Imports) to add/update records, so none of your existing examples to update the Model suits my purpose.
My first question is how can I build a custom pop up form for Add/Edit?
Secondly, how do I code up the Razor and Controller action to handle this Add/Edit from the pop up form?
For example:
Razor:
@(Html.Kendo().Grid<Models.Delegates>()
.Name("grid")
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("Delegates_Read", "Home", new { employeeId = Model.EmployeeId }))
.Create(create=> create.Action("Delegates_Create", "Home")) // How to pass parameters for adding new record here?
)
.Columns(columns =>
{
columns.Bound(delg => delg.EMPL_I).Title("Staff ID");
columns.Bound(delg => delg.EMPL_M).Title("Employee Name");
columns.Bound(delg => delg.POSN_X).Title("Position");
columns.Bound(delg => delg.DEPT_NODE_M).Title("Department");
columns.Bound(delg => delg.EFFT_D).Title("Effective from").Format("{0:dd/MM/yyyy}");
columns.Bound(delg => delg.EXPY_D).Title("Expiry date").Format("{0:dd/MM/yyyy}");
columns.Command(command => { command.Edit(); }).Width(70);
})
.ToolBar(toolbar => toolbar.Create())
.Editable(editable => editable.Mode(GridEditMode.PopUp))
.Pageable()
)
And in controller, can I do something like this or how else?
public ActionResult Delegates_Add([DataSourceRequest]DataSourceRequest request,
string employeeId, string delegatedEmployeeId, DateTime effectiveDate, DateTime expiryDate, string loginUser)
{
_db.AddUpdateDelegateRight(employeeId, delegatedEmployeeId, effectiveDate, expiryDate, null, null, null, null, loginUser);
//How do I handle and relay back error messages from the above SP?
//Nothing to return here, how do I get the view to just refresh the grid?
}
I built a Kendo Grid that DataSourced from an EF model, which comes from a database view.
We're using stored procedures (mapped as Function Imports) to add/update records, so none of your existing examples to update the Model suits my purpose.
My first question is how can I build a custom pop up form for Add/Edit?
Secondly, how do I code up the Razor and Controller action to handle this Add/Edit from the pop up form?
For example:
Razor:
@(Html.Kendo().Grid<Models.Delegates>()
.Name("grid")
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("Delegates_Read", "Home", new { employeeId = Model.EmployeeId }))
.Create(create=> create.Action("Delegates_Create", "Home")) // How to pass parameters for adding new record here?
)
.Columns(columns =>
{
columns.Bound(delg => delg.EMPL_I).Title("Staff ID");
columns.Bound(delg => delg.EMPL_M).Title("Employee Name");
columns.Bound(delg => delg.POSN_X).Title("Position");
columns.Bound(delg => delg.DEPT_NODE_M).Title("Department");
columns.Bound(delg => delg.EFFT_D).Title("Effective from").Format("{0:dd/MM/yyyy}");
columns.Bound(delg => delg.EXPY_D).Title("Expiry date").Format("{0:dd/MM/yyyy}");
columns.Command(command => { command.Edit(); }).Width(70);
})
.ToolBar(toolbar => toolbar.Create())
.Editable(editable => editable.Mode(GridEditMode.PopUp))
.Pageable()
)
And in controller, can I do something like this or how else?
public ActionResult Delegates_Add([DataSourceRequest]DataSourceRequest request,
string employeeId, string delegatedEmployeeId, DateTime effectiveDate, DateTime expiryDate, string loginUser)
{
_db.AddUpdateDelegateRight(employeeId, delegatedEmployeeId, effectiveDate, expiryDate, null, null, null, null, loginUser);
//How do I handle and relay back error messages from the above SP?
//Nothing to return here, how do I get the view to just refresh the grid?
}