Intersoft WebGrid Documentation
Value List
See Also Send comments on this topic.
Intersoft WebGrid > WebGrid Features Overview > Customizing Data > Value List

Glossary Item Box

This topic contains the following sections:

Codeless WebValueLIst Data Binding

With declarative DataSource control supported in WebGrid, this makes it very easy for developers to bind the control to a DataSource. In addition to binding the Grid to DataSource control for its main data, WebGrid also enables you to bind a column's value list to DataSource control. This feature completely removes the needs to write codes in the Grid control and allows you to declaratively specify the DataSource control and DataMember for the value list.

As an example, the value list for a WebGridColumn can now be specified declaratively such as:

Code Copy Code
<ISWebGrid:WebGrid...>
            <RootTable DataMember="Products" UseValueListForSorting="Yes">
               <Columns>
                        ...
                       <ISWebGrid:WebGridColumn ...>
                        <ValueList DataMember="Products" DataTextField="ProductName" DataValueField="ProductID">
                        </ValueList>
                      </ISWebGrid:WebGridColumn>
                      ...
               </Columns>
            </RootTable>
</ISWebGrid:WebGrid>

In previous versions, the only way to setup WebValueList is through code behind. You will need to write several line of codes to populate a WebValueList. The declarative WebValueList feature in version 5.0 significantly improves developer's productivity 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 don't need to specify the DataSourceControlID of the WebValueList, such as shown in the above markup sample.

 

Multiple Values Support in WebValueList

WebGrid 5.0 includes enhancement in WebValueList feature to support multiple values data. In previous version, you can easily translate an ID field to user friendly field through WebValueList in WebGrid. However, you can only display one translated value. For instance, RoleID = 1 being translated to Research Staff.

In version 5.0, WebGrid makes it easy to translate multiple values data using the improved WebValueList feature.

To enable multiple values data lookup, you can set EnableMultipleValues property of the WebValueList object to True. You can also specify the separator character used to separate the values data in MultipleValuesSeparator property.
The following image shows the Roles column which values have been properly translated using WebValueList.

 

Automatic Column Sorting useing WebValueList

Since the introduction of WebGrid 3.1, WebValueList has been one of the most popular feature in WebGrid control. With WebValueList, you can easily translate ID to Text Lookup by using the DataSource populated in the WebValueList object. For instance, the Supplier Name in the WebGrid above is actually an ID column which is translated to Company Name field of Suppliers table through WebValueList.

In version 5.0, WebValueList feature has been significantly enhanced to overcome several limitations introduced in previous versions of WebGrid. The column sorting and grouping can now take advantage of the same DataSource that populated in the WebValueList. With this enhanced WebValueList, you no longer have to manually retrieve the text field of the value column in the WebGrid's main DataSource.

Sample codes (ASPX):

Code Copy Code
<ISWebGrid:WebGrid id="WebGrid2" runat="server" height="300px" UseDefaultstyle="True" 
            width="100%" DataMember="Products" DataSourceid="ISDataSource1">
            <RootTable DataMember="Products" UseValueListForSorting="Yes">
               <Columns>
                     ...
                       <ISWebGrid:WebGridColumn ...>
                        <ValueList DataMember="Suppliers" DataTextField="CompanyName" DataValueField="SupplierID">
                        </ValueList>
                    </ISWebGrid:WebGridColumn>
                    ...
                </Columns>
            </RootTable>
            <LayoutSettings AllowSorting="Yes" AllowGrouping="Yes">
            </LayoutSettings>
</ISWebGrid:WebGrid>

 

See Also

©2012 Intersoft Solutions Corp. All Rights Reserved.