I am stuck up in a pretty basic page while reading form collection on post.
When I check the IsChecked checkbox, in the post action. I am getting "true, false" in the FormCollection. My goal is to obtain the string in below code and then parse it to boolean.
I have not idea where is the bug, can you please help?

Post Action:
[HttpPost]
public ActionResult Create(FormCollection collection)
{
try
{
var checkedd = collection["IsChecked"].ToString();
var name = collection["Name"].ToString();
return RedirectToAction("Index");
}
catch
{
return View();
}
}
Model:
public class Product
{
public bool IsChecked { get; set; }
[Required]
public string Name { get; set; }
}
View:
<% using (Html.BeginForm()) { %>
<%: Html.AntiForgeryToken() %>
<%: Html.ValidationSummary(true) %>
<fieldset>
<legend>Product</legend>
<div class="editor-label">
<%: Html.LabelFor(model => model.IsChecked) %>
</div>
<div class="editor-field">
<%: Html.CheckBoxFor(model => model.IsChecked) %>
<%: Html.ValidationMessageFor(model => model.IsChecked) %>
</div>
<div class="editor-label">
<%: Html.LabelFor(model => model.Name) %>
</div>
<div class="editor-field">
<%: Html.EditorFor(model => model.Name) %>
<%: Html.ValidationMessageFor(model => model.Name) %>
</div>
<p>
<input type="submit" value="Save" />
</p>
</fieldset>
<% } %>
Productas parameter instead ofFormCollectionand have your page bound to the model?FormCollectionworks :-)Request["IsChecked"]help? I don't know the exact syntax. This is the classic asp way to extract form post values.Request["IsChecked"]also returns "true,false"