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






Gets or sets the type of the column that control how the column content will be rendered.

Syntax

Visual Basic (Declaration) 
<ISNet.Serialization.XmlSerializableAttribute()>
<ISNet.Serialization.BinarySerializableAttribute()>
<DescriptionAttribute("Gets or sets the type of the column.")>
<NotifyParentPropertyAttribute(True)>
<DefaultValueAttribute()>
Public Property ColumnType As ColumnType
Visual Basic (Usage)Copy Code
Dim instance As WebGridColumn
Dim value As ColumnType
 
instance.ColumnType = value
 
value = instance.ColumnType
C# 
[ISNet.Serialization.XmlSerializableAttribute()]
[ISNet.Serialization.BinarySerializableAttribute()]
[DescriptionAttribute("Gets or sets the type of the column.")]
[NotifyParentPropertyAttribute(true)]
[DefaultValueAttribute()]
public ColumnType ColumnType {get; set;}
Delphi 
public read-write property ColumnType: ColumnType; 
JScript 
ISNet.Serialization.XmlSerializableAttribute()
ISNet.Serialization.BinarySerializableAttribute()
DescriptionAttribute("Gets or sets the type of the column.")
NotifyParentPropertyAttribute()
DefaultValueAttribute()
public function get,set ColumnType : ColumnType
Managed Extensions for C++ 
[ISNet.Serialization.XmlSerializableAttribute()]
[ISNet.Serialization.BinarySerializableAttribute()]
[DescriptionAttribute("Gets or sets the type of the column.")]
[NotifyParentPropertyAttribute(true)]
[DefaultValueAttribute()]
public: __property ColumnType get_ColumnType();
public: __property void set_ColumnType( 
   ColumnType value
);
C++/CLI 
[ISNet.Serialization.XmlSerializableAttribute()]
[ISNet.Serialization.BinarySerializableAttribute()]
[DescriptionAttribute("Gets or sets the type of the column.")]
[NotifyParentPropertyAttribute(true)]
[DefaultValueAttribute()]
public:
property ColumnType ColumnType {
   ColumnType get();
   void set (    ColumnType value);
}

Example

The following example shows you how to use ColumnType in WebGridColumn programmatically, in which the column type is button.
C#Copy Code
private void WebGrid1_InitializeDataSource(object sender, ISNet.WebUI.WebGrid.DataSourceEventArgs e)
{
    DataSet ds = new DataSet();
    oleDbDataAdapter1.Fill(ds);
    e.DataSource = ds;
}

private void WebGrid1_PrepareDataBinding(object sender, ISNet.WebUI.WebGrid.DataSourceEventArgs e)
{
    if(!IsPostBack)
    {
       WebGrid1.RetrieveStructure();

       WebGridColumn button = new WebGridColumn();
       button.ColumnType = ISNet.WebUI.WebGrid.ColumnType.Button;
       button.ButtonText = "Edit";
       button.Bound = false;
       button.EditType = ISNet.WebUI.WebGrid.EditType.NoEdit;
       button.Width = System.Web.UI.WebControls.Unit.Pixel(50); 
       WebGrid1.RootTable.Columns.Insert(0,button);
    }
        
}

Remarks

WebGrid provides predefined column type such as CheckBox, Image, ImageAndText and so on, which is most commonly used. For greater level of customization, WebGridColumn contents can also be customized to display rich HTML-based contents by setting its ColumnType to Custom and write the custom content codes in InitializeRow event. To give you better idea and illustration, you can read Walkthrough: Utilizing button ColumnType, Walkthrough: Utilizing various ColumnTypes, Walkthrough: Using CheckBox column in Hierarchical WebGrid and Walkthrough: Configuring Hierarchical CheckBox behavior.

WebGrid.NET Enterprise 5.0 allows you to add ASP.NET server controls to the WebGridCell using the new Template Column Type. When using the Template Column Type, you can put any server side controls inside the CellTemplate property of the WebGridColumn. This capability brings you greater flexibility and control over the data visualization and manipulation that suitable to your application needs. Given the current trend and ability of AJAX in delivering changes from server side control without page postback, this new feature enables developers to achieve broader scenario using professional server-side programming. For more information, you can read Walkthrough: Configure a WebGridColumn to use Templated Cell.

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.