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






Specifies the client side (JavaScript) function that will be invoked when request action to server is about to be made.

Syntax

Visual Basic (Declaration) 
<NotifyParentPropertyAttribute(True)>
<ISNet.Serialization.XmlSerializableAttribute()>
<ISNet.Serialization.BinarySerializableAttribute()>
<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 request action to server is about to be made.")>
<DefaultValueAttribute()>
<ISNet.EventParameterAttribute("controlId, action")>
Public Property OnBeforeRequest As String
Visual Basic (Usage)Copy Code
Dim instance As ClientEvents
Dim value As String
 
instance.OnBeforeRequest = value
 
value = instance.OnBeforeRequest
C# 
[NotifyParentPropertyAttribute(true)]
[ISNet.Serialization.XmlSerializableAttribute()]
[ISNet.Serialization.BinarySerializableAttribute()]
[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 request action to server is about to be made.")]
[DefaultValueAttribute()]
[ISNet.EventParameterAttribute("controlId, action")]
public string OnBeforeRequest {get; set;}
Delphi 
public read-write property OnBeforeRequest: String; 
JScript 
NotifyParentPropertyAttribute()
ISNet.Serialization.XmlSerializableAttribute()
ISNet.Serialization.BinarySerializableAttribute()
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 request action to server is about to be made.")
DefaultValueAttribute()
ISNet.EventParameterAttribute("controlId, action")
public function get,set OnBeforeRequest : String
Managed Extensions for C++ 
[NotifyParentPropertyAttribute(true)]
[ISNet.Serialization.XmlSerializableAttribute()]
[ISNet.Serialization.BinarySerializableAttribute()]
[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 request action to server is about to be made.")]
[DefaultValueAttribute()]
[ISNet.EventParameterAttribute("controlId, action")]
public: __property string* get_OnBeforeRequest();
public: __property void set_OnBeforeRequest( 
   string* value
);
C++/CLI 
[NotifyParentPropertyAttribute(true)]
[ISNet.Serialization.XmlSerializableAttribute()]
[ISNet.Serialization.BinarySerializableAttribute()]
[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 request action to server is about to be made.")]
[DefaultValueAttribute()]
[ISNet.EventParameterAttribute("controlId, action")]
public:
property String^ OnBeforeRequest {
   String^ get();
   void set (    String^ value);
}

Property Value

Returns return value.

Example

The sample below shows you how to display a message box before the grid requests to edit its value.
C#Copy Code
WebGrid1.LayoutSettings.ClientSideEvents.OnBeforeRequest= "WebGrid1_OnBeforeRequest";
The following is the example of the javascript function that is assigned in above event:
JScriptCopy Code
function WebGrid1_OnBeforeRequest(controlId, action) 
{ 
   var WebGrid1 = ISGetObject(controlId); 

   alert("Current Action: " + action); 

   return true; 
}

Remarks

You can specify user-defined Javascript function to respond when request action to server is about to be made. The user-defined function should only contain the name of the function. For example, "DoBeforeReq".

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.

action

The action name of the request.

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.

Complete action list is as following:

  • More - Load more data is requested by users.
  • LoadGroup - Load group data.
  • ColumnSort - Column sorting.
  • Group - Column group.
  • Ungroup - Column ungroup.
  • ChangeGroup - Column group order changed.
  • ColumnFilter - Column filtering.
  • LoadChild - Load child table's contents.
  • ColumnChange - Column's visibility is changed.
  • Refresh - Refresh data source.
  • Custom - Custom actions.

 To give you another idea on using OnBeforeRequest property, you can read Walkthrough: Maintaining scroll position.

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

©2012 Intersoft Solutions Corp. All Rights Reserved.