Intersoft WebGrid Documentation
OnResponse Property
See Also  Example Send Feedback
ISNet.WebUI.WebGrid Namespace > ClientEvents Class : OnResponse Property






Specifies the client side (JavaScript) function that will be invoked when a response from server is returned.

Syntax

Visual Basic (Declaration) 
<ISNet.Serialization.XmlSerializableAttribute()>
<ISNet.Serialization.BinarySerializableAttribute()>
<NotifyParentPropertyAttribute(True)>
<ISNet.EventParameterAttribute("controlId, status")>
<EditorAttribute(EditorBaseTypeName="System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", EditorTypeName="ISNet.WebUI.Design.ClientSideEventEditor, ISNet.WebUI.Design")>
<DescriptionAttribute("Specifies the client side (JavaScript) function that will be invoked when a response from server is returned.")>
<DefaultValueAttribute()>
Public Property OnResponse As String
Visual Basic (Usage)Copy Code
Dim instance As ClientEvents
Dim value As String
 
instance.OnResponse = value
 
value = instance.OnResponse
C# 
[ISNet.Serialization.XmlSerializableAttribute()]
[ISNet.Serialization.BinarySerializableAttribute()]
[NotifyParentPropertyAttribute(true)]
[ISNet.EventParameterAttribute("controlId, status")]
[EditorAttribute(EditorBaseTypeName="System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", EditorTypeName="ISNet.WebUI.Design.ClientSideEventEditor, ISNet.WebUI.Design")]
[DescriptionAttribute("Specifies the client side (JavaScript) function that will be invoked when a response from server is returned.")]
[DefaultValueAttribute()]
public string OnResponse {get; set;}
Delphi 
public read-write property OnResponse: String; 
JScript 
ISNet.Serialization.XmlSerializableAttribute()
ISNet.Serialization.BinarySerializableAttribute()
NotifyParentPropertyAttribute()
ISNet.EventParameterAttribute("controlId, status")
EditorAttribute(EditorBaseTypeName="System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", EditorTypeName="ISNet.WebUI.Design.ClientSideEventEditor, ISNet.WebUI.Design")
DescriptionAttribute("Specifies the client side (JavaScript) function that will be invoked when a response from server is returned.")
DefaultValueAttribute()
public function get,set OnResponse : String
Managed Extensions for C++ 
[ISNet.Serialization.XmlSerializableAttribute()]
[ISNet.Serialization.BinarySerializableAttribute()]
[NotifyParentPropertyAttribute(true)]
[ISNet.EventParameterAttribute("controlId, status")]
[EditorAttribute(EditorBaseTypeName="System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", EditorTypeName="ISNet.WebUI.Design.ClientSideEventEditor, ISNet.WebUI.Design")]
[DescriptionAttribute("Specifies the client side (JavaScript) function that will be invoked when a response from server is returned.")]
[DefaultValueAttribute()]
public: __property string* get_OnResponse();
public: __property void set_OnResponse( 
   string* value
);
C++/CLI 
[ISNet.Serialization.XmlSerializableAttribute()]
[ISNet.Serialization.BinarySerializableAttribute()]
[NotifyParentPropertyAttribute(true)]
[ISNet.EventParameterAttribute("controlId, status")]
[EditorAttribute(EditorBaseTypeName="System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", EditorTypeName="ISNet.WebUI.Design.ClientSideEventEditor, ISNet.WebUI.Design")]
[DescriptionAttribute("Specifies the client side (JavaScript) function that will be invoked when a response from server is returned.")]
[DefaultValueAttribute()]
public:
property String^ OnResponse {
   String^ get();
   void set (    String^ value);
}

Property Value

Returns return value.

Example

The following sample codes show you to use OnResponse clientside event to intercept last processed request and perform additional custom tasks, such as reverting the row changes when the response status is an error.
C#Copy Code
WebGrid1.LayoutSettings.ClientSideEvents.OnResponse = "DoResponse";
The following is the example of the javascript function that is assigned in above event.
JScriptCopy Code
function DoResponse(gridId, status)
{    
   if (status == "Error")    
   {        // check response's status        
            var grid = wgGetGridById(gridId);        
            if (grid.LastAction == "UpdateRow")        
            {          
               // get the instance of last request's object, 
               // which is wgRow object for UpdateRow action            
               var row = grid.LastRequestObj;                        

               // cancel the changes of specified            
               wgCancelChanges(row.rowElement);        
            }                
   return true;    
   }
}

Remarks

You can specify user-defined Javascript function to respond when the response from server is returned. The user-defined function should only contain the name of the function. For example, "DoResponse".

The function can be defined in either inline or linked JavaScript files and can accept following parameters:

gridId

The ID of the grid calling the function.

status

The status of the response.

Note that you should include the return value of your function. Returning a true value means that default behavior will be processed. Otherwise, the default behavior will be skipped.

The status of the response will be either "Ok" or "Error".

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

Reference

ClientEvents Class
ClientEvents Members

Concepts

Events

©2012 Intersoft Solutions Corp. All Rights Reserved.