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






Represents the text to be displayed instead of cell's value.

Object Model

WebValueList Class

Syntax

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

Example

The following codes respond to the InitializeLayout event which is fired when the layout of WebGrid is being initialized and about to be rendered. The codes show you that the htShipVia's WebValueList is bound to a HashTable object that contains predefined valuelist items. The vlProd utilizes that automated data caching feature which is also implemented by the WebValueList class. The vlProd is bound to the Products table and let the WebGrid performs value to text translation via its DataTextField and DataValueField definition.
C#Copy Code
protected void WebGrid1_InitLayout(object sender, ISNet.WebUI.WebGrid.LayoutEventArgs e) 
{
    // set valuelist for ShipVia
    WebValueList vlShipVia =
        WebGrid1.GetTableByName("Orders").Columns.GetNamedItem("ShipVia").ValueList;
    Hashtable htShipVia = new Hashtable();
    htShipVia.Add("1", "Speedy Express");
    htShipVia.Add("2", "United Package");
    htShipVia.Add("3", "Federal Shipping");
    vlShipVia.DataSource = htShipVia;
    
    // set valuelist for Products
    WebValueList vlProd =
        WebGrid1.GetTableByName("Order Details").Columns.GetNamedItem("ProductID").ValueList;
    
    if (!vlProd.IsDataCached()) 
    {
        daProducts.Fill(dsNorthWind1.Products);
        vlProd.DataSource = dsNorthWind1;
    }
    
    vlProd.DataMember = "Products";
    vlProd.DataTextField = "ProductName";
    vlProd.DataValueField = "ProductID";
}

Remarks

The class is designed to allow different data to be displayed instead of default cell's text or value. It can accept HashTable or DataSet-based DataSource as its datasource.

Since WebGrid.NET 5.0 is supported with datasource control, it will be easy for developers to bind the Grid to datasource control for its main data. In addition, WebGrid also enables you to bind a column's value list to datasource control. This feature allows you to declaratively specify the datasource control and datamember for the value list without writing codes in the Grid control.
As an example, the value list for a WebGridColumn can now be specified declaratively such as:
<ValueList DataMember="Products" DataTextField="ProductName" DataValueField="ProductID"/>

In the previous version, you must setup WebValueList through code behind. You need to write several line of codes to populate a WebValueList. The declarative WebValueList feature in WebGrid.NET 5.0 improves developer's productivity extensively by eliminating codes. 

When the WebGrid is bound to ISDataSource control, you can bind the WebValueList to an existing ISDataSourceTable defined in the ISDataSource control. In this case, you do not need to specify the DataSourceControlID of the WebValueList, such as shown in the above markup sample.

For more information on binding a WebValueList, you can read Walkthrough: Using WebValueList in WebGrid, Walkthrough: Binding a WebValueList to a table defined in ISDataSourceControl and Walkthrough: Binding a WebValueList to different Datasource control.

WebGrid.NET 5.0 Enterprise supports Multiple Values WebValueList. You can experience this powerful feature simply by set the EnableMultipleValues to True. You can specify the separator character used to separate the values data in MultipleValuesSeparator property. WebGrid.NET 5.0 Enterprise also includes the ability to edit the multiple values data that translated using the WebValueList. For more information regarding multiple values on WebValueList, you can read Walkthrough: Configure the WebValueList of a WebGridColumn to translate multiple values data.

In version 5.0, WebValueList feature has been significantly enhanced to overcome several limitations existed in previous versions of WebGrid. The column sorting and grouping now can take advantage of the same datasource that populated in the WebValueList. You can enable the sorting on WebValueList by enabling the UseValueListForSorting property. With this enhanced WebValueList, you no longer have to manually retrieve the text field of the value column in the WebGrid's main datasource. For more information you can read Walkthrough: Configures automatic column sorting for a column using WebValueList.

Inheritance Hierarchy

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

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.