I apologize if asking some questions these days. But appreciate for all kind helps. Actually, I need to pass data from View to Controller using MVC3 Razor.
Here is the View Code:
Html.RenderAction("Checks", Model.GetRoleNames);
Here is the Controller Code:
public ActionResult Checks(string[] getRoleNames)
{
// The parameter is NULL which should NOT be!
//ViewBag.Name = name;
//return View(values);
return View();
}
Here is the Partial View Code:
@model string[]
@{
for (int i = 0; i < Model.Length; i++)
{
<input id="@ViewBag.Name@(i)" name="@ViewBag.Name" type="checkbox" value="@(Model[i])" />
<label for="@ViewBag.Name@(i)">@Model.[i]</label>
<br />
}
}
The Problem: Model.GetRoleNames has values inside the View as I tried tracing line by line. But no value is passed to the Controller Action as parameter! I don't know the possible reason.
Can anyone help me please?