I am a newbie with Kendo and trying to wrap my head around the grid control. Here is what i am trying to accomplish.
Create a grid to add new records(these will not be sent back to the server at this time)
Be able to delete or edit the records added.
Bound these records with a model
The information on the view will be passed to through the session to a different page and then submitted to the server. The problem i am having is i am only able to add one record. I enter the information and click on add new record again and it wipes out the one i created.
I have attached a pic of how my grid looks like.
Below is my code for the grid. Since i am not passing info to the server i just created dummy create and destroy actions and controller.
@(Html.Kendo().Grid<HSBEnrollment.Models.EnrollAccountData>()
.Name("grid")
.AutoBind(false)
.Scrollable(scr => scr.Height(350))
.Editable(editable => editable.CreateAt(GridInsertRowPosition.Top))
.ToolBar(tbar => tbar.Create())
.Columns(c => {
c.Bound(m => m.EnrollAccountsId).Width(150);
c.Bound(m => m.AccountNum).Width(150);
c.Bound(m => m.AccountTypeId).Width(150);
c.Command(command => { command.Destroy(); }).Width(100);
})
.DataSource(dataSource => dataSource
.Ajax()
.ServerOperation(false)
.Model(m =>
{
m.Id(EnrollAccountData => EnrollAccountData.EnrollAccountsId);
m.Field(EnrollAccountData => EnrollAccountData.AccountNum);
m.Field(EnrollAccountData => EnrollAccountData.AccountTypeId);
})
.Create("IngGrid_Create", "Grid") // <-- dummy action that doesn't exist in controller
.Destroy("IngGrid_Destroy", "Company") // <-- dummy action that doesn't exist in controller
)
)