Page 166 - DCAP312_WEB_TECHNOLOGIES_II
P. 166
Web Technologies-II
Notes <br/>
<asp:label id= “mess” runat= “server”/>
</form>
</body>
</html>
8.3.3 Dropdown List
The DropDownList control is used to create a drop-down list.
Each selectable item in a DropDownList control is defined by a ListItem element!
<script runat= “server”>
Sub submit(sender As Object, e As EventArgs)
mess.Text= “You selected “ & drop1.SelectedItem.Text
End Sub
</script>
<!DOCTYPE html>
<html>
<body>
<form runat= “server”>
<asp:DropDownList id= “drop1” runat= “server”>
<asp:ListItem>Item 1</asp:ListItem>
<asp:ListItem>Item 2</asp:ListItem>
<asp:ListItem>Item 3</asp:ListItem>
<asp:ListItem>Item 4</asp:ListItem>
<asp:ListItem>Item 5</asp:ListItem>
<asp:ListItem>Item 6</asp:ListItem>
</asp:DropDownList>
<asp:Button Text= “Submit” OnClick= “submit” runat= “server”/>
<p><asp:label id= “mess” runat= “server”/></p>
</form>
</body>
</html>
8.3.4 Listbox
The ListBox control is used to create a single- or multi-selection drop-down list.
Each selectable item in a ListBox control is defined by a ListItem element!
<script runat= “server”>
Sub submit(Sender As Object,e As EventArgs)
mess.Text= “You selected“ & drop1.SelectedItem.Text
End Sub
</script>
<!DOCTYPE html>
160 LOVELY PROFESSIONAL UNIVERSITY