I am trying to bind dictionary values ββinside MVC.
Inside the action, I have:
model.Params = new Dictionary<string, string>(); model.Params.Add("Value1", "1"); model.Params.Add("Value2", "2"); model.Params.Add("Value3", "3");
and in the view I have:
@foreach (KeyValuePair<string, string> kvp in Model.Params) { <tr> <td> <input type="hidden" name="Params.Key" value="@kvp.Key" /> @Html.TextBox("Params[" + kvp.Key + "]") </td> </tr> }
But the view does not display the initial values, and when the form is submitted, is the Params property null?
dictionary c # asp.net-mvc model-binding
user644344 Mar 04 '11 at 8:23 2011-03-04 08:23
source share