i m using two dropdown box one for country and other for state.i want that when i will select any value form country dropdown box then related state will come on state drop down box .
RSS
i m using two dropdown box one for country and other for state.i want that when i will select any value form country dropdown box then related state will come on state drop down box .
santosh22526...
Member
9 Points
36 Posts
i m using two dropdown box one for country and other for state.i want that when i will select any...
Feb 20, 2012 03:48 AM|LINK
i m using two dropdown box one for country and other for state.i want that when i will select any value form country dropdown box then related state will come on state drop down box .
i m using c# asp.net.
kedarrkulkar...
All-Star
34013 Points
5468 Posts
Re: i m using two dropdown box one for country and other for state.i want that when i will select...
Feb 20, 2012 03:51 AM|LINK
if u r using AjaxControl toolkit...
http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/CascadingDropDown/CascadingDropDown.aspx
with the help of jQuery... read this good article by Mike
http://www.mikesdotnetting.com/Article/97/Cascading-DropDownLists-with-jQuery-and-ASP.NET
in MVC
http://weblogs.asp.net/rajbk/archive/2010/05/20/cascadingdropdown-jquery-plugin-for-asp-net-mvc.aspx
if u dont bother of postback... set SelectedIndexchanged event on first dropdown... and set its AutoPostback property to true
in the SelectedIndexchanged event write code to populate second dropdown...
hope this helps...
</div>KK
Please mark as Answer if post helps in resolving your issue
My Site
santosh22526...
Member
9 Points
36 Posts
Re: i m using two dropdown box one for country and other for state.i want that when i will select...
Feb 20, 2012 03:56 AM|LINK
i m using asp dropdown box
kedarrkulkar...
All-Star
34013 Points
5468 Posts
Re: i m using two dropdown box one for country and other for state.i want that when i will select...
Feb 20, 2012 04:31 AM|LINK
I am not sure what u referring by this.... I assumed u r using asp dropdown
anyways, try these steps
1) create country dropdown and set its autopstback property to true (so that on chaning country, page will post back)
<asp:dropdown id="cmbCountry" runat="server" AutoPostBack="true" OnSelectedIndexChanged="cmbCountry_Changed"/>
2) create event cmbCountry_Changed in codebehind...
Protected void cmbCountry_Changed(Object sender, EventArgs e) {
// read selected value of country dropdown
string strCountry = cmbCountry.selectedValue;
//use strCountry to select corrosponding states from database and bind (populate) state dropdown
}
hope this helps...
KK
Please mark as Answer if post helps in resolving your issue
My Site
setahamid
Participant
1299 Points
245 Posts
Re: i m using two dropdown box one for country and other for state.i want that when i will select...
Feb 20, 2012 04:37 AM|LINK
You can use the Jquery ajax in asp.net for binding the country and state dorpdownlist to avoid the page refresh .
following is the example how to bind the dropdown using jquery ajax ;
http://hamidseta.blogspot.in/2012/02/bind-dropdownlist-using-jquery-ajax-in.html
Hamid Seta
http://www.hamidseta.blogspot.com/
Remember to click “Mark as Answer” on the post, if it helps you.
vinay13mar
Star
7756 Points
1626 Posts
Re: i m using two dropdown box one for country and other for state.i want that when i will select...
Feb 20, 2012 04:40 AM|LINK
Hi,
check the link
http://msdn.microsoft.com/en-us/library/aa581792.aspx
V.K.Singh
ram.chittala
Member
6 Points
3 Posts
Re: i m using two dropdown box one for country and other for state.i want that when i will select...
Dec 19, 2012 05:18 AM|LINK
you can use the jquery ajax binding with json object
Here i found a good example
http://techiebrains.blogspot.in/2012/12/binding-dropdownlist-with-jquery-ajax.html