Introduction : In this tutorial expalain how to bind dropdownlist like city state and country from the database using asp.net c#. when selecting data from one dropdown it can be fill anothe dropddownlist from the onchange event of dropdownlist.
Step1: Create database and add table city state country as following
SnapShor : Table Country
SnapShot : Table State
SnapShot : Table City
Step 3 : Html Source
Step 4: Code Behind file
O/P SnapShot :
Step1: Create database and add table city state country as following
SnapShor : Table Country
SnapShot : Table State
SnapShot : Table City
Step 3 : Html Source
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form2" runat="server"> <div> <asp:DropDownList ID="
Country" runat="server" Height="33px" Width="162px" AutoPostBack="True" OnSelectedIndexChanged="ddlCountry_SelectedIndexChanged"> </asp:DropDownList> <br /> <br /> <asp:DropDownList ID="
drop
State" runat="server" Height="23px" Width="161px" AutoPostBack="True" OnSelectedIndexChanged="ddlState_SelectedIndexChanged"></asp:DropDownList> <br /> <br /> <asp:DropDownList ID="
drop
City" runat="server" Height="28px" Width="158px" AutoPostBack="True" OnSelectedIndexChanged="ddlCity_SelectedIndexChanged"></asp:DropDownList> <br /> </div> <asp:Button ID="Button1" runat="server" Height="33px" OnClick="Button1_Click" Text="Button" Width="74px" /> </form> </body> </html>
drop
Step 4: Code Behind file
O/P SnapShot :
Sign up here with your email
2 comments
Write commentsnice coding and tutorial
Replynice post....
Replyhow to make multi column drop down with search in asp.net
ConversionConversion EmoticonEmoticon