c# - How can I trigger dropdown while viewing asp.net page -
there 2 dropdown in asp.net page. when select first 1 (city), second 1 (district) triggered.
i have save button page.
when click save button, write selectedvalues of dropdowns in database. , when open page again, assign values dropdown's selected values.
the first 1 ok when assign dropdown.selectedvalue
= "5" second 1 not triggered. how can trigger it?
thanx.
i have done same thing. suppose have drop down ddlcountry , ddlcity. need load cities selected country.
protected void page_load(object sender, eventargs e) { if(!ispostback) { loadcountriesindropdown(ddlcountry); ddlcountry.selectedvalue = "5" //for eg: loadcitiesbycountryselected(ddlcity, ddlcountry.selectedvalue); // selected country value set here 5 ddlcountry_selectedindexchanged(null, null); } } protected void ddlcountry_selectedindexchanged(object sender, eventargs e) { if(ddlcountry.selecteditem.text == "select") { ddlcity.items.clear(); } else { loadcitiesbycountryselected(ddlcity, ddlcountry.selectedvalue); } }
hope wanted.
Comments
Post a Comment