Fields Property
Returns the collection of explicitly defined fields in the ObjectListFieldCollection class.
public System.Web.UI.MobileControls.ObjectListFieldCollection Fields {
get
}
Remarks
You can add or remove fields in the collection by using the Add, AddAt, Remove, and RemoveAt methods of the ObjectListFieldCollection class.
Example
The following example demonstrates how to use the Fields property to add an ObjectListField element to an ObjectListFieldCollection.
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then
ObjectList1.AutoGenerateFields = False
' Add the ObjectListFields item to the ObjectListFieldCollection
' of ObjectList1.
Dim ListField1 As New ObjectListField()
ListField1.DataField = "BookName"
ListField1.Title = "BookName"
ObjectList1.Fields.Add(ListField1)
End If
End Sub
[C#]
public void Page_Load(Object sender, EventArgs e)
{
if(!IsPostBack)
{
ObjectList1.AutoGenerateFields = false ;
// Add the ObjectListFields item to the ObjectListFieldCollection
// of ObjectList1.
ObjectListField ListField1 = new ObjectListField();
ListField1.DataField = "BookName";
ListField1.Title = "BookName";
ObjectList1.Fields.Add(ListField1);
}
}
See Also
Applies to: ObjectList Class