Intersoft WebGrid Documentation
Using ClientAction Engine
See Also Send comments on this topic.
Intersoft WebGrid > Learning More > Working with Advanced Client-Server Interaction > Using ClientAction Engine

Glossary Item Box

ClientAction Engine was first introduced in to enable smoother client interactions during server OnTheFly-PostBack context. The ClientAction is now embedded in Framework level to provide shared functionality among other products. Numerous powerful features have been added into the enhanced ClientAction engine such as the ability to easily set value and assign a WebStyle to any valid HTML elements.

In V5.0, more features are added into the ClientAction engine. One of the most exciting feature is the ability to RefreshModifiedControls on the fly. One of the examples on how to do this is available in our tutorial file(V4.0/FlyPostBackRenderControls.aspx), it allows controls which are edited during OnTheFly Postback to be modified. Below is a sample code which shows you how to do this.

C# Copy Code
private void WebGrid1_UpdateRow(object sender, ISNet.WebUI.WebGrid.RowEventArgs e)
{
    if (e.Row.Cells.GetNamedItem("Country").Text == "UK") 
    {
        Label1.BackColor = Color.Red;
        TextBox1.Text = "Can't update this row!";
                
        // Refresh any intrinsic controls whose properties
        // have been changed since Load event.
        WebGrid1.ClientAction.RefreshModifiedControls(); 
    }
    else
    {
        Label1.BackColor = Color.White;
        TextBox1.Text = "Update OK!";
        WebGrid1.ClientAction.RefreshModifiedControls();
    }
}

In previous version, you can also achieve above scenario but with more codes and efforts. You have to implement OnAfterResponse client side event and write the function to check for many cases in the OnAfterResponse event in order to achieve one easy task.

The example above shows how to use ClientActionEngine during OnTheFly Postback. When a row is about to be updated, it performs some checking then configures a TextBox control and refreshes it.

One important thing to note about ClientActionEngine is that it is only applicable during OnTheFly Postback, you cannot use it in full Postback.

See Also

©2012 Intersoft Solutions Corp. All Rights Reserved.