List<Country_tbl> listOfCountry = MyDataBase.Country.Liste.Complete;//get list of Country from database controls.DropDownList.Bind(listOfCountry, ddlCountry );//binding list to ddl if (Request.Cookies["SelectedCountry"] != null) { string Countryid=Request.Cookies["SelectedCountry"].Value; controls.DropDownList.SelectItem(ddlCountry, Countryid);//select item from ddl that have Value==countryid List<State_tbl> listOfState = MyDataBase.State.list(Countryid);//BreakPoint: here i check ddlCountry it have One Selected Value controls.DropDownList.Bind(listOfState , ddlState); //if (Request.Cookies["SelectedState"] != null) //{ // string Stateid=Request.Cookies["SelectedState"].Value; // controls.DropDownList.SelectItem(ddlState, Stateid); // List<City_tbl> listOfCity = MyDataBase.City.list(Cityid); // controls.DropDownList.Bind(listOfCity , ddlCity); // ///... //} }// BreakPoint: in this point i found that ddlCountry have two Selected value
public static void Select(DropDownList ddl, string Value) { ddl.ClearSelection(); ddl.Items.FindByValue(Value).Selected = true; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)