Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
410
Grid and Updating feature
posted

I have a grid with Updating feature turn on using the GridModel class, but when I click on the row the row gets in edit mode and all the data in the row gets deleted. Can you please help with this?

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

List<GridColumn> columns = new List<GridColumn>()

{

 

 

 

 

new GridColumn("ID", "ID", "int", "100px"),

 

 

 

new GridColumn("Code", "Code", "string", "100px"),

 

 

 

new GridColumn("Description", "Description", "string", "100px"),

}

 

 

 

 

 

 

 

 

 

GridModel model = new GridModel("grid1", "ID", columns, Url.Action("GetList/"));

 

 

 

GridUpdating updating = new GridUpdating();

 

model.Features.Add(updating);

 

 

 

 

 

return

PartialView(model);

  • 2535
    Offline posted

    Hi,

    This is because the type of the primaryKey column is with not correct format.

    You have to change type of column ID from int to number:

     new GridColumn("ID""ID""number""100px"

    insted of 

     new GridColumn("ID""ID""int""100px"


    Hope this helps,

    Nadia

  • 410
    posted

    I found out that this happens when I set the PrimaryKey of the grid. I removed the PrimaryKey from the grid and it worked. Can you please explain why?