What does Html.HiddenFor do?

后端 未结 4 2037
春和景丽
春和景丽 2020-11-27 04:06

Although I have read the documentation on Html.HiddenFor, I\'ve not grasped what is it used for...

Could somebody explain its uses and give a short example?

4条回答
  •  猫巷女王i
    2020-11-27 05:05

    And to consume the hidden ID input back on your Edit action method:

    [HttpPost]
    public ActionResult Edit(FormCollection collection)
    {
        ViewModel.ID = Convert.ToInt32(collection["ID"]);
    }
    

提交回复
热议问题