MVC Controller parameter for a form element with a dot in it?

前端 未结 3 2014
孤城傲影
孤城傲影 2021-02-19 18:45

If you\'re using the Html.TextBoxFor() type methods, you may well end up with Form controls that have dots in their names, like this:

3条回答
  •  感情败类
    2021-02-19 19:12

    As Clicktricity suggests in comments you may use

    [HttpPost]
    public ActionResult FooAction(FormCollection form)
    {
        firstName = form["Contact.FirstName"];
    }
    

提交回复
热议问题