This is the basic of
Asp.net. Better you could have gone through a book to understand the flow and events of dropdown list. You should read the documentation of
DropDownList
.
Try this:
HTML:
<asp:dropdownlist id="DropDownList1" runat="server" xmlns:asp="#unknown">
onselectedindexchanged="DropDownList1_SelectedIndexChanged" AutoPostBack="true">
</asp:dropdownlist>
C#:
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
Response.Write(DropDownList1.SelectedItem.Text);
}
All the best.
--Amit