ASP.net
Awesome
Learn
Forum
Buy
Demos
Sign In
☾
☀
Switch to
Dark
Light
Mode
this site works best with javascript enabled
Ask Question
HiddenFor in a HtmlBeginForm not work
Title:
B
I
{code}
?
Hi,i have a view like this: @using (Html.BeginForm("Create", "Test")) { @Html.EditorFor(o => o.Name) @Html.EditorFor(o => o.Surname) @Html.EditorFor(o => o.FiscalCode) @Html.EditorFor(o => o.DataNascita) @Html.EditorFor(o => o.Email) } When i click on save button all work fine.but now i have need to use HiddenFor in BeginForm : @using (Html.BeginForm("Create", "Test")) { @Html.HiddenFor(o => o.Id) @Html.EditorFor(o => o.Name) .... But after this insert the SaveButton not work and the controller is no call! Why?
Save Changes
Cancel
Kondor
asked at 13 Feb 2014
where is this form ? where's the save button ? why do you need the hiddenfor ? do you get any errors in browser console ?
at 13 Feb 2014
Omu
(you're not supposed to add answers (that is not answer), rather comment by clicking "add comment"), my first guess you're getting validation on that hidden input
at 15 Feb 2014
Omu
Answers
B
I
{code}
?
HiddenFor is used for pass the Id of my record to controller,otherwise is null,i not get errors,the controller is not called
Save Changes
Cancel
Kondor
answered at 15 Feb 2014
please
Sign In
to leave an answer
By accessing this site, you agree to store cookies on your device and disclose information in accordance with our
cookie policy
and
privacy policy
.
OK