|
|
|
Example of Pre-Selecting a Data-Driven Dropdown list box Dropdown List Box
You can enter a category in the Textbox and then click on the Button labeled "Select Default Category ID" to set the default selection of the dropdown list box .
==== Source Code Listing === <%@ Page Language="VB" %> <%@ import Namespace="System.Data.OleDb" %> <%@ import Namespace="System.Data" %> <script runat="server"> Sub Page_Load( ByVal sender As System.Object, ByVal e As System.EventArgs) If Not ISPostBack Then
End If End Sub Sub ButtonSubmit_Click(sender As Object, e As EventArgs)
End Sub Sub ButtonSetCategoryID_Click(sender As Object, e As EventArgs)
End Sub </script> <html> <head> </head> <body> <form runat="server"> <p> Category: <asp:DropDownList id="DropDownList1" runat="server" Width="157px"></asp:DropDownList> </p> <p> <asp:Button id="ButtonSubmit" onclick="ButtonSubmit_Click" runat="server" Text="Submit"></asp:Button> </p> <p> Category ID Chosen: <asp:TextBox id="TextBoxCID" runat="server"></asp:TextBox> </p> <p> <asp:Button id="ButtonSetCategoryID" onclick="ButtonSetCategoryID_Click"
runat="server" </p> <p> <asp:Label id="Label1" runat="server"></asp:Label> </p> <!-- Insert content here --> </form> </body> </html> |