I’m working with C# + MVC3.
I have a radiobutton on a form, but I’m having some problems.
At Index.cshtml, I have:
<div class="display-label">
Label
</div>
<div class="display-field">@Html.RadioButton("rdActive", ((FakeClass)ViewBag.FakeFilter).Situation, "S");
At Index of my Controller, i have:
ViewBag.FakeFilter = new FakeClass()
{
Situacao = (Request.Form["rdActive"] == "" ? null : Request.Form["rdActive"])
}
And I’m getting ArgumentNullPointerException
For what I understand of your error it’s throws Nullpontier because you’re receiving empty in the
Request.Form["rdActive"]so when the code passes for the action returns null to the viewbag.Now what i see strange it’s that the overload of the helper receives in the last parameters a Boolean and you’re passing an string with “s”.
this
Should be
or
Check the parameters