HTML Controls->ASP.NET HtmlSelect Control
2007-03-26 15:36
489 查看
Definition and Usage
The HtmlSelect control is used to control a <select> element. In HTML, the <select> element is used to create a drop-down list.Properties
Property | Description |
---|---|
Attributes | Returns all attribute name and value pairs of the element |
DataMember | A name of a data table to use |
DataSource | A data source to use |
DataTextField | A field in the data source to be displayed in the drop-down list |
DataValueField | A field in the data source that specifies the value of each selectable item in the drop-down list |
Disabled | A Boolean value that indicates whether or not the control should be disabled. Default is false |
id | A unique id for the control |
InnerHtml | Sets or returns the content between the opening and closing tags of the HTML element. Special characters are not automatically converted to HTML entities |
InnerText | Sets or returns all text between the opening and closing tags of the HTML element. Special characters are automatically converted to HTML entities |
Items | The list of items in the drop-down list |
Multiple | Whether multiple items can be selected at a time |
OnServerChange | The name of the function to be executed when the selected item has changed |
runat | Specifies that the control is a server control. Must be set to "server" |
SelectedIndex | The index of the currently selected item |
Size | The number of visible items in the drop-down list |
Style | Sets or returns the CSS properties that are applied to the control |
TagName | Returns the element tag name |
Value | The value of the currently selected item |
Visible | A Boolean value that indicates whether or not the control should be visible |
Examples
HTMLSelect<script runat="server"> Sub choose_image(Sender As Object, e As EventArgs) image1.Src = select1.Value End Sub </script> <html> <body> <form runat="server"> <select id="select1" runat="server"> <option value="smiley.gif">Smiley</option> <option value="angry.gif">Angry</option> <option value="stickman.gif">Stickman</option> </select> <input type="submit" runat="server" value="Display image" OnServerClick="choose_image"> <br /><br /> <img id="image1" src="smiley.gif" runat="server" width="32" height="32" /> </form> </body> </html> |
Smiley Angry Stickman ![]() |
Smiley Angry Stickman ![]() |
相关文章推荐
- HTML Controls->ASP.NET HtmlForm Control
- HTML Controls->ASP.NET HtmlInputCheckBox Control
- HTML Controls->ASP.NET HtmlInputText Control
- HTML Controls->ASP.NET HtmlGeneric Control
- HTML Controls->ASP.NET HtmlTableCell Control
- HTML Controls->ASP.NET HtmlAnchor Control
- HTML Controls->ASP.NET HtmlTableRow Control
- HTML Controls->ASP.NET HtmlButton Control
- HTML Controls->ASP.NET HtmlInputImage Control
- HTML Controls->ASP.NET HtmlInputButton Control
- HTML Controls->ASP.NET HtmlInputRadioButton Control
- asp.net当修改header时提示:The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>)
- ASP.NET AJAX Roadmap--Server Controls (9): UpdateProgress Control Overview
- Web Server Controls->ASP.NET Button Control
- Web Server Controls->ASP.NET Image Control
- Web Server Controls->ASP.NET PlaceHolder Control
- ASP.NET 后台CS访问前台HTMLSELECT控件的值
- Using ASP.NET 3.5's ListView and DataPager Controls: Grouping Data with the ListView Control (翻译)
- html动态加载select标签的option项(ASP.NET)
- ASP.NET 后台CS访问前台HTMLSELECT控件的值