populating dropdownlist based on the selection of item from other dropdownlist in asp.net
-
Am new to asp.net, I have created to dropdownlist named country and district and binded the data for each dropdownlist from two different tables called tblcountry and tbldistrict When the county changes in Country dropdownlist, I want the district dropdown to automatically update with a list of districts in that country. can anyone help me.. Thanks in Advance
-
Am new to asp.net, I have created to dropdownlist named country and district and binded the data for each dropdownlist from two different tables called tblcountry and tbldistrict When the county changes in Country dropdownlist, I want the district dropdown to automatically update with a list of districts in that country. can anyone help me.. Thanks in Advance
I assume this is a Linq to SQL question - and that you are using SQL datasource? 1) databind both dropdowns to a LINQdataSource 2) the LINQdataSource for Country dropdown is tblCountry 3) the LINQdataSource for District dropdopwn is tblDistrict 4) add a WHERE clause to the District LinqDataSource: WHERE [Country] == [control] - [CountryDropdown] 5) make the country dropdown AutoPostback=true - so when a user changes the country, the District is repopulated. ASP handles the dependencies. Read this [^]for more info.
'Howard