I have a page that serves two purposes, mostly viewing an entry in the database, but some of the fields are displayed in textfields/textareas because you can edit some values and then depending on the button you select at the bottom, you can update those entries. I especially like the textarea because of it's look/feel, naturally resizeable in the page, and comes with standard right-click options like SelectAll, etc. thx to browser support.
Anyway, one of those fields (shown in a textarea) I'd like to prevent from coming through upon postback because that value isn't going to be edited (I've even made it @readonly so you can't even edit the textarea).
How to accomplish preventing form postback for an input from the ASPX page? I know that is counter-intuitive in general, but I thought perhaps there's a way similar to the Hidden inputs. Also, I know that in the controller I could just wipe that field in the model before doing anything with the model submitted from the form, but I'm curious if there is some option from the page that I could do.
I'm using this syntax to define the textarea:
<%: Html.TextAreaFor(model => model.Key, new { @readonly = "readonly", @class = "readonly", cols = 62, rows = 15 })%>
EDIT:
I probably should have noted that one of the main reasons I need to do this is because one of the model fields may contain some HTML in it. This is an internal website and that field cannot be edited manually, so no one can input HTML, it is just a value in the database that comes from a license generation program. And so, when I use a TextArea in a form that is bound to a model field, ASP.NET throws an exception upon binding the TextArea data back to the model to send upon postback.
I saw the SO answers using [AllowHtml] and [ValidateInput(false)] attributes, one wasn't available to me in MVC2 and the other requires downgrading the requestValidationMode, so I am looking for an alternative way to prevent the possible HTML value from being posted back at all (but still displayed in a textarea).