Returns the string representation of the
UltraListViewItemBase.Value property.
Syntax
| Visual Basic (Declaration) | |
|---|
Public ReadOnly Property Text As String |
| C# | |
|---|
public string Text {get;} |
Example
The following code sample demonstrates how to populate the UltraListView's Items collection from the 'Orders' table in the Northwind database:
| Visual Basic | Copy Code |
|---|
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinListView
Private Sub PopulateItemsCollection(ByVal ordersTable As DataTable)
Dim dataRow As DataRow
Dim dataColumn As DataColumn
For Each dataRow In ordersTable.Rows
Dim orderItem As UltraListViewItem = Me.ultraListView1.Items.Add(Nothing, dataRow("OrderID"))
Dim subItemColumn As UltraListViewSubItemColumn
For Each subItemColumn In Me.ultraListView1.SubItemColumns
DataColumn = CType(subItemColumn.Tag, DataColumn)
Dim subItem As UltraListViewSubItem = orderItem.SubItems(subItemColumn)
subItem.Value = dataRow(DataColumn)
If subItem.Key = "ShipVia" Then subItem.Appearance = Me.ultraListView1.Appearances(subItem.Text)
Next
Dim customerID As String = CType(dataRow("CustomerID"), String)
orderItem.Group = Me.ultraListView1.Groups(customerID)
Next
End Sub
|
| C# | Copy Code |
|---|
using Infragistics.Win; using Infragistics.Win.UltraWinListView; using System.Diagnostics;
private void PopulateItemsCollection(
DataTable ordersTable )
{
// Populate the Items collection from the Rows
collection of the 'Orders' table.
foreach( DataRow dataRow
in ordersTable.Rows )
{
// Add an
UltraListViewItem for this order, using the value of the
// 'OrderID' field for
the item's Value
UltraListViewItem orderItem =
this.ultraListView1.Items.Add( null,
dataRow["OrderID"] );
// Set the values for
the UltraListViewItem's SubItems. Note that we
// can use an
UltraListViewSubItemColumn instance to index into the
// SubItemColumns
collection, and use the stored reference to the underlying
// DataColumn to index
into the DataRow's columns.
foreach(
UltraListViewSubItemColumn subItemColumn in this.ultraListView1.SubItemColumns
)
{
DataColumn dataColumn =
subItemColumn.Tag as DataColumn;
UltraListViewSubItem subItem =
orderItem.SubItems[subItemColumn];
subItem.Value = dataRow[dataColumn];
//
Assign the Appearance we created for this shipper to the
//
UltraListViewSubItem's Appearance.
if
( subItem.Key == "ShipVia" )
subItem.Appearance
= this.ultraListView1.Appearances[subItem.Text];
}
// Assign the
UltraListViewGroup which represents this order's customer
// to the item's Group
property.
string customerID = dataRow["CustomerID"] as string;
orderItem.Group = this.ultraListView1.Groups[customerID];
}
} |
See Also