0
I have a doubt about hiddenfield in aspx we use the following command:
<asp:HiddenField ID="HiddenField1" runat="server" />
And for cshtml it is possible?
0
I have a doubt about hiddenfield in aspx we use the following command:
<asp:HiddenField ID="HiddenField1" runat="server" />
And for cshtml it is possible?
0
In Razor you can use the @Html.HiddenFor()
which will be very useful if you are using a Model
@Html.HiddenFor(m => m.Propriedade)
Otherwise, as in the example presented in the question... it does not make much sense to create this component on the server side if it is to represent a model object, but it can be done, too:
@Html.Hidden("HiddenField1","valorQuandoSelecionado")
In that case it would be better to write pure html anyway...
<input type="checkbox" name="HiddenField1" value="valorQuandoSelecionado" />
Browser other questions tagged c# asp.net-mvc asp.net aspx
You are not signed in. Login or sign up in order to post.
It worked! Thanks! @Html.Hiddenfor(m => m.Property)
– user139623