DeviceSpecific.SelectedChoice DeviceSpecific.SelectedChoice DeviceSpecific.SelectedChoice DeviceSpecific.SelectedChoice Property


取得目前選取的選項,如果都不適用則為 nullGets the currently selected choice, or null if none are applicable. 這個 API 已經過時。This API is obsolete. 如需如何開發 ASP.NET 行動應用程式的資訊,請參閱 Mobile Apps & Sites with ASP.NET (使用 ASP.NET 來開發行動應用程式與網站)。For information about how to develop ASP.NET mobile applications, see Mobile Apps & Sites with ASP.NET.

 property System::Web::UI::MobileControls::DeviceSpecificChoice ^ SelectedChoice { System::Web::UI::MobileControls::DeviceSpecificChoice ^ get(); };
public System.Web.UI.MobileControls.DeviceSpecificChoice SelectedChoice { get; }
member this.SelectedChoice : System.Web.UI.MobileControls.DeviceSpecificChoice
Public ReadOnly Property SelectedChoice As DeviceSpecificChoice


目前選取的選項。The currently selected choice.


下列程式碼範例示範如何使用SelectedChoice屬性來顯示與目前選擇相關聯的篩選準則。The following code example demonstrates how to use the SelectedChoice property to display the filter associated with the current choice. 如需更完整的程式碼範例, 請參閱DeviceSpecific總覽的範例。For a more complete code sample, see the example for the DeviceSpecific overview.

public void Page_Load(object source, EventArgs e)
    if (!IsPostBack)
        string txt = "Selected Filter is {0}";
        Label1.Text = String.Format(txt, 
Public Sub Page_Load(ByVal source As Object, ByVal e As EventArgs)
    If Not IsPostBack Then
        Dim txt As String = "Selected Filter is {0}"
        Label1.Text = String.Format(txt, _
    End If
End Sub


您可以使用特定/選擇結構來指定控制項或樣式的裝置特定內容, 例如屬性覆寫或範本。You can use a DeviceSpecific/Choice construct to specify device-specific content, such as property overrides or templates, for a control or style. 若要從裝置 <>專案中的選擇中選取選擇, ASP.NET 會依序依目標裝置的功能來評估每個選擇。To select a choice from the choices in a <DeviceSpecific> element, ASP.NET evaluates each choice in sequential order against the capabilities of the target device. 第一個符合的選擇會成為選取的選擇, 並用於裝置特定的內容。The first matching choice is made the selected choice, and is used for device-specific content.