Hello,
I am using OrmLite technology in my MVC code. I need help to bind selected Cascaded DropdownLists (Country, State, City) for a logged in user which is saved on Signup Form.
Below is my code (this code binds only Country):
var countrystring = "SELECT Id, CountryName FROM CountryMaster where Id ='" + countryid + "'";
DataSet ds = new DataSet();
List li = new List();
DataTable dt = new DataTable();
dt = objdal.MyMethod(countrystring.ToString());
List list = new List();
foreach (DataRow row in dt.Rows)
{
list.Add(new SelectListItem { Text = Convert.ToString(row.ItemArray[1]), Value = Convert.ToString(row.ItemArray[0])});
}
ViewBag.country = list;
Here it binds Country based on CountryId, but another CountryNames is not getting bound.
Thanks in advance.
Vincent Maverick DuranoPosted Aug 30, 2018, 1:40 PM
Guest UserPosted Aug 30, 2018, 12:44 PM
I am able to bind cascaded dropdownlist on Page Load. I need help to bind it on Edit View (i.e When User is logged in to dashboard, it should fetch those dropdownlist value which User saved on Register or Signup Form)
Vincent Maverick DuranoPosted Aug 30, 2018, 9:43 AM