hi to all,Here i want to bind in drop-down from database using modal.But i bind the value using viewdata. so kindly help how to bind drop-down from database using modals. DESCRIPTION:-in controllerList<SelectListItem> list = new List<SelectListItem>(); list.Add(new SelectListItem { Text = "Select Country", Value = "Select Country" });//set default text for DropdownList var cat = (from c in db.Country select c).ToArray();//get data from database using linq for (int i = 0; i < cat.Length; i++) { list.Add(new SelectListItem { Text = cat[i].Country_Name, Value = cat[i].Country_Cde.ToString() }); } ViewData["ViewCountry"] = list;
Kindly suggest Explain me how to bind values in drop-down from database using modals.