Proprietà Value

Imposta o restituisce il valore che identifica l'elemento dell'elenco. Il valore predefinito è null.

public string Value {
   get,
   set
}

Ereditarietà

Di seguito è riportato un elenco delle classi che ereditano la proprietà Value dalla classe MobileListItem.

Classe ObjectListItem

Osservazioni

Se la proprietà è null, la chiamata effettuata per ottenere il valore restituisce il valore della proprietà Text.

Esempio

Nell'esempio che segue viene illustrato come utilizzare la proprietà Value per recuperare il valore della selezione.

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

If Not IsPostBack Then
   
   SelectionList1.DataValueField = "URL"
   Dim arr As New ArrayList()
   arr.Add(New Navigation("Travel Site", "http://www.margiestravel.com"))
   arr.Add(New Navigation("Home Site", "https://www.microsoft.com"))
   SelectionList1.DataSource = arr
   SelectionList1.DataBind()

End If

End Sub

Sub Command1_OnClick(sender As [Object], e As EventArgs) 

   RedirectToMobilePage(SelectionList1.Selection.Value.ToString()) 

End Sub

[C#]

public void Page_Load(Object sender, EventArgs e)
{
   if (!IsPostBack)
   { 
      SelectionList1.DataValueField="URL";
      ArrayList arr = new ArrayList();
      arr.Add (new Navigation ("Travel Site", 
                               "http://www.margiestravel.com"));
      arr.Add (new Navigation ("Home Site",
                               "https://www.microsoft.com"));
      SelectionList1.DataSource = arr;
      SelectionList1.DataBind ();
   }
}
void cmd1_OnClick(Object sender, EventArgs e)
{
     RedirectToMobilePage(SelectionList1.Selection.Value.ToString())
}   

Vedere anche

Si applica a: classe MobileListItem