I am using Asp.Net MVC 4 C#
I want to use dictionary type so, on first page load in controller I tried this:
Dictionary<int, string> dictionary = new Dictionary<int, string>();
for (int i = 1; i < 51; i++)
{
dictionary.Add(i, "blue");
}
ViewBag.Colour = dictionary;
And in View I am passing it back through Hidden field
@Html.Hidden("Colour", (Dictionary<int,string>)@ViewBag.Colour)
Now on [HttpPost]
I want to access all the values (Key,Value) from collection["Colour"]
and may be update the Value part on some condition.