Intersoft WebGrid Documentation
WebGridColumn Class
Members  Example  See Also  Send Feedback
ISNet.WebUI.WebGrid Namespace : WebGridColumn Class






Represents a column of data that belongs to a WebGridTable object. WebGridColumn provides sophisticated and powerful configurations that allow users to work more effectively with data processing. Some of those configurations are: AggregateFunction, AllowGrouping, AllowSorting, AllowSizing, and so on.

Object Model

WebGridColumn Class

Syntax

Visual Basic (Declaration) 
<DescriptionAttribute()>
<PersistenceModeAttribute(PersistenceMode.InnerProperty)>
<SerializableAttribute()>
Public Class WebGridColumn 
   Inherits ISNet.WebUI.NamedObjectBase
   Implements ISNet.ICopyable, ISNet.IResetable, ISNet.Serialization.BinarySerialization.IBinarySerialize, ISNet.Serialization.XmlSerialization.ICustomXmlSerializer, ISNet.WebUI.INamedObject 
Visual Basic (Usage)Copy Code
Dim instance As WebGridColumn
C# 
[DescriptionAttribute()]
[PersistenceModeAttribute(PersistenceMode.InnerProperty)]
[SerializableAttribute()]
public class WebGridColumn : ISNet.WebUI.NamedObjectBase, ISNet.ICopyable, ISNet.IResetable, ISNet.Serialization.BinarySerialization.IBinarySerialize, ISNet.Serialization.XmlSerialization.ICustomXmlSerializer, ISNet.WebUI.INamedObject  
Delphi 
public class WebGridColumn = class(ISNet.WebUI.NamedObjectBase, ISNet.ICopyable, ISNet.IResetable, ISNet.Serialization.BinarySerialization.IBinarySerialize, ISNet.Serialization.XmlSerialization.ICustomXmlSerializer, ISNet.WebUI.INamedObject)
JScript 
DescriptionAttribute()
PersistenceModeAttribute(PersistenceMode.InnerProperty)
SerializableAttribute()
public class WebGridColumn extends ISNet.WebUI.NamedObjectBase implements ISNet.ICopyable, ISNet.IResetable, ISNet.Serialization.BinarySerialization.IBinarySerialize, ISNet.Serialization.XmlSerialization.ICustomXmlSerializer, ISNet.WebUI.INamedObject 
Managed Extensions for C++ 
[DescriptionAttribute()]
[PersistenceModeAttribute(PersistenceMode.InnerProperty)]
[SerializableAttribute()]
public __gc class WebGridColumn : public ISNet.WebUI.NamedObjectBase, ISNet.ICopyable, ISNet.IResetable, ISNet.Serialization.BinarySerialization.IBinarySerialize, ISNet.Serialization.XmlSerialization.ICustomXmlSerializer, ISNet.WebUI.INamedObject  
C++/CLI 
[DescriptionAttribute()]
[PersistenceModeAttribute(PersistenceMode.InnerProperty)]
[SerializableAttribute()]
public ref class WebGridColumn : public ISNet.WebUI.NamedObjectBase, ISNet.ICopyable, ISNet.IResetable, ISNet.Serialization.BinarySerialization.IBinarySerialize, ISNet.Serialization.XmlSerialization.ICustomXmlSerializer, ISNet.WebUI.INamedObject  

Example

 

The following example shows you how to create WebGridColumn programmatically, in which the column type is check box.
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 check = new WebGridColumn();
       check.Bound = false;
       check.ColumnType = ISNet.WebUI.WebGrid.ColumnType.CheckBox;
       check.IsRowChecker = true;
       check.Width = System.Web.UI.WebControls.Unit.Pixel(20);
       WebGrid1.RootTable.Columns.Insert(0,check);
    }       
}

Remarks

In order to find better performance and stability, WebGrid.NET v5.0 improves some of its existing features. One of the enhancement has been made is column ordering of WebGridColumn. The enhancement also includes displaying the original order when removed then reshown and displaying the original order when ungrouped then grouped back from context menu. In addition, version 5.0 provides new EditType, a resizable text box edit control. 

WebGridColumn provides several ColumnType which allow you to display rich information that contains images, images and text, check box and so on.

WebGridColumn can work in Bound or Unbound mode in a DataBound WebGrid. It can also be added or removed dynamically at runtime. The modification of WebGridColumnCollection object is recommended to be write in InitializeLayout event. The concept is to centralize all your layout-related codes to be in one function for better readability, easier maintenance and debugging.

WebGridColumn object has been designed to be as flexible as possible to meet many business requirements. You can write your own custom content that contains rich HTML by setting the ColumnType to Custom. You write the custom content codes in InitializeRow event on when a row is about to be rendered.

By default, the AllowMultiLine property is set to False for more consistent layout. In this case, WebGrid will automatically truncate the cell's text and add ellipsis (...) in the right most of the cell's text. It will also automatically popup a tooltip of the complete cell's text when the mouse is over the truncated cell. You can turn the AllowMultiLine property to True if your data contains ENTER or other linebreak characters.

One of popular configuration is AggregateFunction, in which you can get the result of aggregate function shown in total rows or group total rows for a column. The provided aggregation functions such as Count, Sum, Average, Min and Max are generally applicable to most application's requirements. However, it doesn't allow you to perform your own calculation on the grouped rows or footer's totaling. Users also configure AggregateFunction using column footer. Users can quickly analyze summary of information, in either grouped or flat mode. The column footer is designed to be synchronized to UI interactions, such as grouping, ungrouping, resizing or column moving. The column footer shows the summary information of all rows, regardless of grouped rows. It can also correctly calculate the result when used in conjunction with VirtualLoad paging mode.    

WebGridColumn also provides the mechanism for value to text translation through ValueList property. Developers can now easily display different data instead of its value that is more readable and useful by assigning the ValueList property with WebValueList object that has been properly constructed.

WebGrid.NET Enterprise 5.0 now provides built-in feature for Required Input during data editing and makes data validation a snap. When the cell of the specified column is empty, the updating will be blocked until all required input are filled. To enable user input, simply set InputRequired property to True at WebGridColumn level. You can also modify the error message in the InputRequiredErrorText property. With this built-in feature, data validation for requiring user input can be achieved easily without has to write single line of codes. For more information you can read How-to: Enable required input validation for a column.

Another new feature presented by WebGrid.NET Enterprise 5.0 is the ability to add ASP.NET server controls to the WebGridCell using the new Template ColumnType. 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 further information you can read Templated Cell.

You can use Eval or Bind method for declarative data binding in the child controls of the CellTemplate.
For instance,
<ISWebGrid:WebGridColumn Caption="ContactName" ColumnType="Template"    DataMember="ContactName" Name="ContactName" Width="200px"> <CellTemplate> <asp:Label ID="Label1" runat="server" Text='<%# Bind("ContactName") %>' ForeColor="Red" Font-Italic="true" /> </CellTemplate>

</ISWebGrid:WebGridColumn>

 

Inheritance Hierarchy

System.Object
   ISNet.WebUI.WebUIBaseClass
      ISNet.WebUI.NamedObjectBase
         ISNet.WebUI.WebGrid.WebGridColumn

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.