Share via


Remove Method (ObjectListFieldCollection)

Removes the specified field.

public void System.Web.UI.MobileControls.ObjectListField Remove(
   System.Web.UI.MobileControls.ObjectListField field
)

Parameters

  • field
    The field to remove.

Remarks

Not available in the IObjectListFieldCollection interface.

Removing a field from the fields of an object list changes the data-binding behavior of the control, and requires you to bind data to the control again.

Example

The following example demonstrates how to use the Remove method to remove an item from the ObjectListFieldCollection.

Sub CommandClick(sender as Object, e As ObjectListCommandEventArgs)

    ObjectList1.Fields.Remove(ObjectList1.Fields(0))

   'Associate array to ObjectList object.
   ObjectList1.DataSource = Ctype(Session("MyArray"), ArrayList)

   'Must bind data again.
   ObjectList1.DataBind()
   ObjectList1.ObjectListViewMode.List



End Sub

[C#]

void CommandClick(Object sender, ObjectListCommandEventArgs e)
{
   ObjectList1.Fields.Remove(ObjectList1.Fields[0]);

   // Associate array to ObjectList object.
   ObjectList1.DataSource = (ArrayList) Session["MyArray"];

   // Must bind data again.
   ObjectList1.DataBind();
   ObjectList1.ObjectListViewMode.List;

}    

See Also

Remove Method (DeviceSpecificChoiceCollection) | Remove Method (MobileListItemCollection) | Remove Method (ObjectListCommandCollection) | Remove Method (StyleSheet)

Applies to: ObjectListFieldCollection Class