ListControl.Text 属性


获取或设置 ListControl 控件的 SelectedValue 属性。Gets or sets the SelectedValue property of the ListControl control.

 virtual property System::String ^ Text { System::String ^ get(); void set(System::String ^ value); };
public virtual string Text { get; set; }
member this.Text : string with get, set
Public Overridable Property Text As String





属性获取并设置SelectedValue属性所用的相同值。 TextThe Text property gets and sets the same value that the SelectedValue property does.

属性通常用于确定ListControl控件中选定项的值。 SelectedValueThe SelectedValue property is commonly used to determine the value of the selected item in the ListControl control. 如果未选择任何项,则返回空字符串("")。If no item is selected, an empty string ("") is returned.

你还可以使用SelectedValue属性来选择ListControl控件中的项,方法是将其设置为项的值。You can also use the SelectedValue property to select an item in the ListControl control by setting it with the value of the item. 如果控件中的ListControl任何项都不包含指定的值System.ArgumentOutOfRangeException ,则将引发异常。If no items in the ListControl control contain the specified value, an System.ArgumentOutOfRangeException exception is thrown.

控件开发人员可以重SelectedValue写属性,以支持与SelectedValue属性不相关的功能。Control developers can override the SelectedValue property to support features that are not related to the SelectedValue property.

无法通过主题或样式表主题设置此属性。This property cannot be set by themes or style sheet themes. 有关详细信息,请ThemeableAttribute参阅和ASP.NET 主题和外观For more information, see ThemeableAttribute and ASP.NET Themes and Skins.