Intersoft WebGrid Documentation
Walkthrough: Modifying AllowEdit and AllowDelete attributes using client side programming
See Also Send comments on this topic.

Glossary Item Box

This walkthrough shows you how to set AllowEdit and AllowDelete in WebGrid.

During this walkthrough, you will learn how to do the following:

 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

  1. Bind WebGrid to AccessDataSource.
  2. Create a HTML button to invoke the clientside function.
  3. Create a html function to disable the allowedit and allowdelete like following:

  4. JavaScript Copy ImageCopy 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; 
    }
    

See Also

©2012 Intersoft Solutions Corp. All Rights Reserved.