Reputation: 91
I have the following code to include a checkbox to show deleted items as part of a list:
<input name="DeletedItems" value="ShowDeleted" type="checkbox">
<label for="showdeleted">Show deleted itmes</label>
This code is located with in the view. My question is: How do I retrieve this value within the controller for this view. I need to retrieve this value in order to to determine whether to show the deleted items or not. Thank you.
Upvotes: 1
Views: 647
Reputation: 3019
You can use FormCollection object to retrieve check box value..
view:
<:input name="DeletedItems" value="ShowDeleted" type="checkbox">
Controller:
[HttpPost]
public ActionResult YourAction( FormCollection result) {
string CheckBoxValue=result["DeletedItems"];
}
Upvotes: 1