Click here to Skip to main content
15,889,834 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have collection of data

i want to select ddl on basis of previous selection

HTML
   @for (int i = 0; i < Model.listAddressEnity.Count; i++)
                    {
     @Html.DropDownListFor(x => x.listAddressEnity[i].City_ID, (SelectList)ViewBag.City_ID)
}


C#
var selectList = new SelectList(objCityHandler.SP_GET_CITY().Select(s => new { Id = s.City_ID, Name = s.City_Name }), "Id", "Name");
               ViewBag.City_ID = selectList;


My problem is data in List

No problem in single data
C#
var selectList = new SelectList(objCategoryHandler.SP_GET_CATEGORY().Select(s => new { Id = s.Categoty_ID, Name = s.Category_Name }), "Id", "Name", objProductCollectionEntity.ProductEntity.Categoty_ID);



but how to do selection with List
Posted

Bind List data to dropdownlist
SQL
@Html.DropDownList("Country", ViewBag.City_ID as SelectList,
         "Select City", new { style = "width:200px" })
 
Share this answer
 
Comments
Member-515487 5-Apr-14 2:00am    
i want if user select any any city and save it then it show get selected
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900