NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

HtmlSelect Class

The HtmlSelect class defines the methods, properties, and events for the HtmlSelect control. This class allows programmatic access to the HTML <select> element on the server.

Object
   Control
      HtmlControl
         HtmlContainerControl
            HtmlSelect

[Visual Basic]
Public Class HtmlSelect
   Inherits HtmlContainerControl
   Implements IPostBackDataHandler
[C#]
public class HtmlSelect : HtmlContainerControl,
   IPostBackDataHandler
[C++]
public __gc class HtmlSelect : public HtmlContainerControl,
   IPostBackDataHandler
[JScript]
public class HtmlSelect extends HtmlContainerControl,
   IPostBackDataHandler

Remarks

[To be supplied.]

Requirements

Namespace: System.Web.UI.HtmlControls

Assembly: System.Web.dll

Example [Visual Basic]

The following example demonstrates how option entries can be dynamically added to an HtmlSelect control.

[Visual Basic]

<html>
   <script language="VB" runat=server>
      Overrides Sub_Load()
        If (IsFirstLoad = true) Then
MyList.Items.Add "Basketball"
MyList.Items.Add "Football"
MyList.Items.Add "Soccer"
        End If
       End Sub

       Sub SubmitBtn_Click (ByVal Source As Object, ByVal E as EventArgs)
           Message.InnerHtml = "Favorite sport: "& MyList.Value
       End Sub
    </script>
    <body>
       <form method=post runat=server>
         Select your favorite sport:
         <select id="MyList" size=1 runat=server>
           <option>Baseball</option>
           <option>Ping Pong</option>
         </select>

         <input type=button value="Enter" OnServerClick="SubmitBtn_Click" runat=server>

         <h1><span id="Message" runat=server></span></h1>
       </form>
    </body>
</html>

See Also

HtmlSelect Members | System.Web.UI.HtmlControls Namespace