AutoPostBack property of the DropDownList in asp.net

DropDownList control has Autopostback property, you can set True or false to this property. If you set this property to True, then Form Containing the DropDownList control is submitted automatically whenever a new option is selected. Here it is very important to notice that AutoPostback property uses client side javascript , if a browser does not support javaScript or if JavaScript is disabled on the browser, then this property does not work.

For better understanding we take an example, In this example we have a DropDownList control with AutoPostback (True) property and when a new item is selected, the SelectedIndexChanges event is raised that is associated with DropDown_SelectedIndexChanged. So whenever a new item is selected, the form is submitted and the DropDown_SelectedIndexChanged subroutine is executed.

<script runat="server">
    Sub DropDown_SelectedindexChanged()
        MsgBox("Index is changed")
    End Sub
    </script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Find Selected item in DropDownList control</title>
</head>
<body style="height: 410px; width: 768px">
    <form runat="server">
    <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="true" OnSelectedIndexChanged="DropDown_SelectedindexChanged">
    <asp:ListItem Text="USA" Value="1" />
    <asp:ListItem Text="India" Value="2" />
    <asp:ListItem Text="Japan" Value="3" />
    </asp:DropDownList>
   </form>
</body>
</html>