I just had some great advice on how to set the width of an input field in MVC:
@Html.TextBoxFor(model => model.Status.RowKey, new { size = 200, disabled = "disabled", @readonly = "readonly" })
Now I hav tried it for another type of field but it doesn't work:
@Html.EditorFor(model => model.Status.BrowserTitle, new { size = 80 })
I would also like to set this for 80 characters but when I do this the source does not change and does not show 80.
Bev
If you need to use EditorFor and not TextBoxFor and have multiple editors on the page, but only need to change the width of specific ones... The easiest what is to add a css style to the class ID as such:
<style type="text/css">
input#Status.BrowserTitle { width: 80px; }
</style>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With