Hi!
i have three tables in database province,division, and subdivision. i entered 4 provinces in province table using asp.net web page1. in next web page2 i used dropdown which get data from province table. for each province in dropdown i entered 6 divisions using textbox and save it in the division table. now in third web page3 i used two dropdowns one for province and one for division and a text box for subdivision entry.
i want that when i select a province from dropdown(e.g punjab) so the dropdown2 show me those divisions that i have entered for that particular province(e.g divsion1,divsion2 for punjab),not all the divisions of all the provinces. how is it possible?????please help me
Loading

Posted May 18, 2011, 10:51 PM EDT
Kindly let me know, if you have any issues.
Abhimanyu K VatsaRank #14 · 51.7K reputationPosted May 18, 2011, 9:46 PM EDT
Refer this post http://www.vbdotnetheaven.com/UploadFile/abhikumarvatsa/2333/
saifullah khanRank #4,887 · 320 reputationPosted May 18, 2011, 9:57 PM EDT
1. should i bind both of the dropdowns to division table?
2. could you please tell me query?
Abhimanyu K VatsaRank #14 · 51.7K reputationPosted May 18, 2011, 10:21 PM EDT
for the very first dropdown (province) bind the all database record (you have 4 records). Code would be something like,
DataSourceID="SqlDataSource1"
DataTextField="province"
DataValueField="ID"
Runat="server" AutoPostBack="True" />
SelectCommand="SELECT [ID], [province] FROM [tblprovince]">
Note: remember to mark autopostback enabled.
Job2
Use the code in the code-behind for selectedIndexChenged event of above dropdown.
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
//here you have to place the binding data of division drop down
}
i hope this helps
Posted May 18, 2011, 10:26 PM EDT
http://www.asp.net/ajax/ajaxcontroltoolkit/samples/CascadingDropDown/CascadingDropDown.aspx
http://www.asp.net/ajax/ajaxcontroltoolkit/samples/walkthrough/ccdwithdb.aspx
http://www.aspsnippets.com/Articles/Creating-Cascading-DropDownLists-in-ASP.Net.aspx
Abhimanyu K VatsaRank #14 · 51.7K reputationPosted May 19, 2011, 12:35 AM EDT
saifullah khanRank #4,887 · 320 reputationPosted May 19, 2011, 12:44 AM EDT