Free Support Forum - aspose.com

Allowing row inserts but not deletes

Using gridweb v4.8, would like to prevent users from deleting rows, but allow adding of new rows. In our application, data is never deleted, but rather marked as deleted (i.e. just set a checkbox that binds to a ‘deleted’ Db column). Adding new rows of data is on the other hand allowed. Currently ‘EnableClientRowOperations’ & ‘Enable RowAddDelete’ enables both.

Hi,

Well, you can remove/disable some menu items e.g “Add Row”, the procedure is a simple as a workaround. i.e.,

Create a new javascript language file same like “lang_en.js” (You may also update the existing “lang_en.js” file. but this method is not recommended) which is stored in stored by default in the …\Program Files\Aspose\Aspose.Cells for .NET\acw_client folder,
Open it into notepad and edit it to Save it As for your need. You may set the labels for the related lines e.g., MenuItemAddRow :“Add Row”, MenuItemInsertRow :“Insert Row”, to:
MenuItemAddRow :"",
MenuItemInsertRow :"",
so that the option will not be shown in the context menu when the user utilizes the right click menu of the gridweb.
In your code you may try to set the code(e.g in Page_Load event):

GridWeb1.ACWLanguageFileUrl = “http://localhost/Aspose.Cells.GridWeb.Demos/lang_en1.js”;

Thank you.