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






Gets or sets custom attributes that will be written in the cell object's tag.

Syntax

Visual Basic (Declaration) 
<DescriptionAttribute("Gets or sets custom attributes that will be written in the cell object's tag.")>
<NotifyParentPropertyAttribute(True)>
<BrowsableAttribute(False)>
<DefaultValueAttribute()>
Public Property CustomObjectAttributes As String
Visual Basic (Usage)Copy Code
Dim instance As WebGridCell
Dim value As String
 
instance.CustomObjectAttributes = value
 
value = instance.CustomObjectAttributes
C# 
[DescriptionAttribute("Gets or sets custom attributes that will be written in the cell object's tag.")]
[NotifyParentPropertyAttribute(true)]
[BrowsableAttribute(false)]
[DefaultValueAttribute()]
public string CustomObjectAttributes {get; set;}
Delphi 
public read-write property CustomObjectAttributes: String; 
JScript 
DescriptionAttribute("Gets or sets custom attributes that will be written in the cell object's tag.")
NotifyParentPropertyAttribute()
BrowsableAttribute()
DefaultValueAttribute()
public function get,set CustomObjectAttributes : String
Managed Extensions for C++ 
[DescriptionAttribute("Gets or sets custom attributes that will be written in the cell object's tag.")]
[NotifyParentPropertyAttribute(true)]
[BrowsableAttribute(false)]
[DefaultValueAttribute()]
public: __property string* get_CustomObjectAttributes();
public: __property void set_CustomObjectAttributes( 
   string* value
);
C++/CLI 
[DescriptionAttribute("Gets or sets custom attributes that will be written in the cell object's tag.")]
[NotifyParentPropertyAttribute(true)]
[BrowsableAttribute(false)]
[DefaultValueAttribute()]
public:
property String^ CustomObjectAttributes {
   String^ get();
   void set (    String^ value);
}

Example

The following sample codes show you how to use CustomObjectAttributes property. In the sample below, an attribute of onclick =doUpdate() will be added after the Save button.
C#Copy Code
private void WebGrid1_InitializeRow(object sender, ISNet.WebUI.WebGrid.RowEventArgs e)
{
   if(e.Row.Type==RowType.Record)
   {
      if(e.Row.Table.DataMember=="TestTable")
      {   
         e.Row.Cells.GetNamedItem("Save").CustomObjectAttributes="onclick=doUpdate()";
      }    
   }
}
You also need to put this Javascript code in the client side
C#Copy Code
<script language = "javascript">

 function doUpdate() 
 { 
   var grid = ISGetObject("WebGrid1"); 
   var row = grid.GetSelectedObject().GetRowObject(); 
   var cells = row.GetCells(); 
   alert(" updating row... now it has been changed to " + cells[1].Text ); 
   row.SetChanged(); row.Update(); // perform Update 
 }
</script>

Remarks

This property will only take affect when ColumnType is set to CheckBox, Button, Image, ImageAndText. The CustomObjectAttributes property can contain custom data which you want it to be rendered inside the object's tag. This is most commonly used when there is need to do more interaction in client side, such as popping up an Edit window or Property window which base on the row's UniqueID, and so on.

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.