This walkthrough shows you how to set AllowEdit and AllowDelete in WebGrid.
During this walkthrough, you will learn how to do the following:
- Manipulate the grid clientside XML element to modify the AllowEdit and AllowDelete properties.
Prerequisites
In order to complete this walkthrough, you will need the following:
- Access to the Microsoft Access Northwind database.
- Visual Studio 2005 Application.
Step-By-Step Instructions
- Bind WebGrid to AccessDataSource.
- Create a HTML button to invoke the clientside function.
- Create a html function to disable the allowedit and allowdelete like following:
-
JavaScript Copy Code function TurnOff() { var grid = ISGetObject("WebGrid1"); // get the XML element that store all properties // of the table var docxml = grid.Tables["Customers"].getXml(); alert("Previously : AllowEdit = " + docxml.getAttribute("allowEdit")); alert("Previously : AllowDelete = " + docxml.getAttribute("allowDelete")); docxml.setAttribute("allowEdit","no"); docxml.setAttribute("allowDelete","no"); alert("Currently : AllowEdit = " + docxml.getAttribute("allowEdit")); alert("Currently : AllowDelete = " + docxml.getAttribute("allowDelete")); return true; }
Other Resources
Walkthrough Topics
How-to Topics