web 2.0

ASP.NET(vb.net) & DropDownlist - asp:DropDownList

ASP.NET(vb.net) & DropDownlist - asp:DropDownList - asp:DropDownList : Enables users to select from a single-selection drop-down list. The drop-down list can contain any number of items.

ShotDev Focus:
- ASP.NET(vb.net) & DropDownlist - asp:DropDownList

ASP.NET(vb.net) & DropDownlist - asp:DropDownList

Tag Control :

<asp:DropDownList id="DropDownList1" runat="server"
DataSource="<% databindingexpression %>"
DataTextField="DataSourceField"
DataValueField="DataSourceField"
AutoPostBack="True|False"
OnSelectedIndexChanged="OnSelectedIndexChangedMethod">

<asp:ListItem value="value" selected="True|False">
Text
</asp:ListItem>

</asp:DropDownList>

Example

DropDownList.aspx

<%@ Page Language="VB" %>
<script runat="server">

Sub btnSubmit_OnClick(Obj as Object, e As EventArgs)
Me.lblText1.Text = Me.DropDownList1.SelectedItem.Text
End Sub

Sub DropDownList2_SelectedIndexChanged(Obj as Object, e As System.EventArgs) Handles DropDownList2.SelectedIndexChanged
Me.lblText2.Text = Me.DropDownList2.SelectedItem.Text
End Sub

</script>
<html>
<head>
<title>ShotDev.Com Tutorial</title>
</head>
<body>
<form runat="server">
<asp:DropDownList id="DropDownList1" runat="server">
<asp:ListItem>Items 1</asp:ListItem>
<asp:ListItem>Items 2</asp:ListItem>
<asp:ListItem>Items 3</asp:ListItem>
<asp:ListItem>Items 4</asp:ListItem>
<asp:ListItem>Items 5</asp:ListItem>
</asp:DropDownList>
<asp:DropDownList id="DropDownList2" AutoPostBack="True" runat="server">
<asp:ListItem>Items 1</asp:ListItem>
<asp:ListItem>Items 2</asp:ListItem>
<asp:ListItem>Items 3</asp:ListItem>
<asp:ListItem>Items 4</asp:ListItem>
<asp:ListItem>Items 5</asp:ListItem>
</asp:DropDownList>
<br /><br />
<asp:Button id="btnSubmit" onclick="btnSubmit_OnClick" runat="server" Text="Submit"></asp:Button>
<br />
<hr />
<asp:Label id="lblText1" runat="server"></asp:Label>
<br>
<asp:Label id="lblText2" runat="server"></asp:Label>
<br />
</form>
</body>
</html>

Screenshot

ASP.NET(vb.net) & DropDownlist - asp:DropDownList
.
.
.
Download this script.
Download

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (No Ratings Yet)
Loading ... Loading ...

Leave a Reply

You must be logged in to post a comment.