Share via


Value Property

Sets or returns the value that identifies the list item. The default value is null.

public string Value {
   get,
   set
}

Inheritance

The following is a list of the classes that inherit the Value property from the MobileListItem class.

ObjectListItem Class

Remarks

If this property is null, a call to retrieve the value returns the value of the Text property.

Example

The following example demonstrates how to use of the Value property to retrieve the value of the selection.

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())
}   

See Also

Applies to: MobileListItem Class