I have a view that displays a textbox as follows:
@Html.TextBoxFor(m => m.CodeGuest, new {style = "display: none"})
it is displayed via javascript (so the user clicks a checkbox).
If javascript is not enabled, I must remove this line (style = "display: none") so that the textbox is displayed by default.
You can use client side logic for this, have it visible as default and hide it with javascript on page load.
If you use jQuery it will be something like this:
And remove the display: none from the Razor logic.
Another solution is to wrap the textbox element in
<noscript>-tags.For example: