Metodo SetAll (MobileListItemCollection)
Imposta la matrice degli oggetti MobileListItem come MobileListItemCollection.
public void SetAll {
System.Web.UI.MobileControls.MobileListItem[] items
}
Parameter
- items
La matrice MobileListItem.
Esempio
Nell'esempio seguente viene mostrato come utilizzare il metodo SetAll per impostare la matrice degli elementi MobileListItem come MobilelistItemCollection.
Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then
Dim _Items(4) As MobileListItem
Dim i As Integer
For i = 0 To 4
Dim _Item As New MobileListItem()
_Item.Text = "Option " + i.ToString()
_Item.Value = "Value " + i.ToString()
_Items(i) = _Item
_Item = Nothing
Next i
List1.Items.SetAll(_Items)
End If
Response.Write(("Item Count : " + list1.Items.Count.ToString()))
End Sub
[C#]
public void Page_Load(Object sender, EventArgs e)
{
if (!IsPostBack)
{
MobileListItem[] _Items = new MobileListItem[5];
for(int i = 0; i < 5; i++)
{
MobileListItem _Item = new MobileListItem();
_Item.Text = "Option " + i;
_Item.Value = "Value " + i;
_Items[i] = _Item;
_Item = null;
}
List1.Items.SetAll(_Items) ;
}
Response.Write("Item Count : " + list1.Items.Count);
}
Vedere anche
Si applica a: classe MobileListItemCollection