I have a function, that collect the value of the controls of some view(.cshtml)
private string ExtractEmailId(FormCollection form)
{
var value = form["CkbQuestion1"];
return value;
}
I am receiving value of Checkbox as "true,false". I need the value of that control. How I can have that?
Any Idea please.
I expect you required the below code. Please replace your code with this.
[HttpPost]
public string ExtractEmailId(FormCollection form)
{
var value = form["CkbQuestion1"];
return value;
}
And you view will be similar to
@Using(Html.Beginform("ExtractEmailId"))
{
<input type="checkbox" name="CkbQuestion1" />
<input type="submit" value="Submit" />
}