c# - How to pass values by POST in ASP.NET MVC 4 -
I have a problem passing the values by POST in ASP.NET MVC 4. This is my operation in User Controller:
[HTTP post] Show public string (at UID, string anonymous) {Retired Yunam. Ut Toasting (); } And in this way I have tried to see the values:
@using (Html.BeginForm ("Show", "Users") ) {Html.Hidden ("uid", Model.Id); Html.Hidden ("uname", Model.UserName); & Lt; Input type = "submit" value = "+" /> } html:
& lt; Form action = "/ user / show" method = "post" & gt; & Lt; Input type = "submit" value = "+" /> & Lt; / Form & gt; and:
@using (Html.BeginForm ("Show", "User", FormMethod.Post, new {uid = 1, uname = "User1"}))) {& lt; Input type = "submit" value = "+" /> } html:
& lt; Form action = "/ user / show" method = "post" uid = "1" uname = "user1" & gt; & Lt; Input type = "submit" value = "+" /> gt; & Lt; / Form & gt; In both ways the verbs get blank rather than the actual values.
Use the Razor syntax not being provided to your HtmlHelpers.
@using (HTML.bizform ("Show", "User")) {@ Html.Hidden ("uid", Model.Id); @ Html.Hidden ("uname", Model.UserName); & Lt; Input type = "submit" value = "+" /> } explanation:
calling Html.Hidden (or html] [anything] ) a method And usually gives a IHtmlString . Without using @ infront, the engine does not know that you are trying to output the returned string. It just thinks that you are calling a method.
Comments
Post a Comment