Intersoft WebGrid Documentation
How-to: Enable Cell Editing when the CheckBox is Checked Using OnCheckBoxClick
See Also Send comments on this topic.

Glossary Item Box

This walkthrough will show you how to use OnCheckBoxClick client side event.

In this topic, you will learn the basic thing on how to enable a readonly cell using OnCheckBoxClick.

To enable readonly cell using OnCheckBoxClick

  1. On WebGrid1_InitializeRow, put the following code:

    C# Copy ImageCopy Code
    protected void WebGrid1_InitializeRow(object sender, ISNet.WebUI.WebGrid.RowEventArgs e)
    {
      e.Row.Cells.GetNamedItem("Address").ForceNoEdit = true;
    }
    

  2. Select WebGrid's instance and press F4.
  3. In Layout Settings, select ClientSideEvents, then set OnCheckBoxClick to WebGrid1_OnCheckBoxClick.
  4. Write the following function in OnCheckBoxClick client side event:

    JavaScript Copy ImageCopy Code
    function WebGrid1_OnCheckBoxClick(controlId, tblName, colName, checkboxValue, originalCheckBoxValue)
    {
      var WebGrid1 = ISGetObject(controlId);
      var selObj = WebGrid1.GetSelectedObject();
      var cel = selObj.ToRowObject().GetCells();
      cel[1].SetForceNoEdit(false);
      return true;
    }
    

  5. Run the project.

See Also

©2012 Intersoft Solutions Corp. All Rights Reserved.