<% using (Html.BeginForm("SubmitUserName")) { %>
<input type='text' name='user-name' />
<input type='submit' value='Send' />
<% } %>
What should be a signature of a corresponding Action method to accept user-name parameter?
public ActionResult SubmitUserName(string user-name) {...}
Method signature above does not work for some reason 😉
I know there is an ActionNameAttribute to handle situation with a dash in action name. Is there something like ParameterNameAttribute?
As everyone has noted, the easiest fix would be not to use a dash. If you truly need the dash, you can create your own ActionFilterAttribute to handle it, though.
Something like:
You would then apply the filter to the appropriate Action method:
You would probably want to enhance the ParameterNameAttribute to handle upper/lower case, but that would be the basic idea.