Intersoft WebGrid Documentation
How-to: Display MessageBox to user if UpdateRow cannot be invoked in a specific case
See Also Send comments on this topic.

Glossary Item Box

MessageBox can be displayed to user if UpdateRow cannot be invoked in a specific case by using ClientAction engine in WebGrid. ClientAction engine is attached per grid instance and designed to bridge the gaps between client and server.

In this topic, you will learn the basic thing on how to display the MessageBox in WebGrid if the UpdateRow can not be invoked.

To display MessageBox in WebGrid

  1. Go to WebGrid properties, server side event.
  2. Attach the WebGrid UpdateRow event into the WebGrid.
  3. Inside of the condition, use ClientAction engine to do a client side Alert.

    C# Copy ImageCopy Code
    private void WebGrid1_UpdateRow(object sender, ISNet.WebUI.WebGrid.RowEventArgs e)
    {    
       if (e.Row.Cells.GetNamedItem("Country").Text == "UK")    
       {        
          // Display alert to user        
          WebGrid1.ClientAction.Alert("You can't update this row!");        
          DataRowView drv = (DataRowView)e.Row.DataRow;        
          drv.Row.RejectChanges();        
          e.ReturnValue = false;    
       }
    }
    

  4. Run the project.

See Also

©2012 Intersoft Solutions Corp. All Rights Reserved.