Hi ,..
I am working on Mvc3 , razor, In my controller a list of Countries is being fetched to
List<SelectListItem> Countries = new List<SelectListItem>();
List as showed above, and one of the country in the list is being selected : [selected =" true"] and stored to a
ViewData["Countries"] = Countries;
these List of countries in Viewdata are being used in drop Down list in my View .
the dropdown code is as below
@Html.DropDownList("Country", (IEnumerable<SelectListItem>)ViewData["Countries"])
so the selected list item is to be displayed in the drop-down , till der its working fine but when ever i refreshed the page in which drop-down exists, the
ViewData["Countries"]
is losing the attribute selected = "true", so the dropdown is not selecting the coutnry i want,when i refreshed the page it by default selecting the 1st list item , [select=true] is disappearing..
please say how to make the viewdata to have the selected=true value even after refresh the page,......