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






Specifies the client side (JavaScript) function that will be invoked when a cell is clicked.

Syntax

Visual Basic (Declaration) 
<ISNet.Serialization.XmlSerializableAttribute()>
<NotifyParentPropertyAttribute(True)>
<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")>
<ISNet.EventParameterAttribute("controlId, tblName, rowIndex, cellIndex, cellEl")>
<ISNet.Serialization.BinarySerializableAttribute()>
<DescriptionAttribute("Specifies the client side (JavaScript) function that will be invoked when a cell is clicked.")>
<DefaultValueAttribute()>
Public Property OnCellClick As String
Visual Basic (Usage)Copy Code
Dim instance As ClientEvents
Dim value As String
 
instance.OnCellClick = value
 
value = instance.OnCellClick
C# 
[ISNet.Serialization.XmlSerializableAttribute()]
[NotifyParentPropertyAttribute(true)]
[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")]
[ISNet.EventParameterAttribute("controlId, tblName, rowIndex, cellIndex, cellEl")]
[ISNet.Serialization.BinarySerializableAttribute()]
[DescriptionAttribute("Specifies the client side (JavaScript) function that will be invoked when a cell is clicked.")]
[DefaultValueAttribute()]
public string OnCellClick {get; set;}
Delphi 
public read-write property OnCellClick: String; 
JScript 
ISNet.Serialization.XmlSerializableAttribute()
NotifyParentPropertyAttribute()
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")
ISNet.EventParameterAttribute("controlId, tblName, rowIndex, cellIndex, cellEl")
ISNet.Serialization.BinarySerializableAttribute()
DescriptionAttribute("Specifies the client side (JavaScript) function that will be invoked when a cell is clicked.")
DefaultValueAttribute()
public function get,set OnCellClick : String
Managed Extensions for C++ 
[ISNet.Serialization.XmlSerializableAttribute()]
[NotifyParentPropertyAttribute(true)]
[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")]
[ISNet.EventParameterAttribute("controlId, tblName, rowIndex, cellIndex, cellEl")]
[ISNet.Serialization.BinarySerializableAttribute()]
[DescriptionAttribute("Specifies the client side (JavaScript) function that will be invoked when a cell is clicked.")]
[DefaultValueAttribute()]
public: __property string* get_OnCellClick();
public: __property void set_OnCellClick( 
   string* value
);
C++/CLI 
[ISNet.Serialization.XmlSerializableAttribute()]
[NotifyParentPropertyAttribute(true)]
[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")]
[ISNet.EventParameterAttribute("controlId, tblName, rowIndex, cellIndex, cellEl")]
[ISNet.Serialization.BinarySerializableAttribute()]
[DescriptionAttribute("Specifies the client side (JavaScript) function that will be invoked when a cell is clicked.")]
[DefaultValueAttribute()]
public:
property String^ OnCellClick {
   String^ get();
   void set (    String^ value);
}

Property Value

Returns return value.

Example

The following example shows how to get the caption of column header when a cell is clicked using client side programming.
C#Copy Code
WebGrid1.LayoutSettings.ClientSideEvents.OnCellClick = "WebGrid1_CellClick";
The following is the example of the javascript function that is assigned in above event.
JScriptCopy Code
function DoCellClick( gridId, tblName, rowIndex, cellIndex )
{       
     // get current WebGrid object     
     var vGridId = wgGetGridById( gridId );        
     
     // get the column header's of the Customers table    
     var tbCH = vGridId.Tables["Customers"].gettbCHElement();        
     
     // get the current selected cell    
     var vCells = tbCH.rows[0].cells;        
     
     // print the column header name of the current selected cell    
     alert( "rowIndex = " + rowIndex + " and cellIndex = " +        
       cellIndex + " and cellHeader = " + vCells[cellIndex].colName);        
     alert( vCells[cellIndex].colName );
}

Remarks

You can specify user-defined Javascript function to respond when the a cell is clicked. The user-defined function should only contain the name of the function. For example, "DoCellClick".

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.

tblName

The Table's Name of the clicked cell.

rowIndex

The clicked cell's rowIndex.

cellIndex

The clicked cell's cellIndex.

cellEl

The clicked cell's element.

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 difference between CellClick and CellSelect is that CellClick will be invoked regardless of the Table's or Layout's setting for CellClickAction. CellSelect will only invoked when CellClickAction is set to CellSelect.

For more information you can Walkthrough: Using OnCellClick and OnRowSelect events in NewRow.

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.