You need to validate on the server, any client side validation is easily hacked. You can add a keypress event handler to your textbox and validate as users type. The check for null strings you can do when you read the values in your viewmodel, just use ?? to replace null with string.Empty.
I was going to say that Razor has nothing to do with it, but I realised that is not true. A textbox in HTML is like this:
<input type="text"...
and then a key press event would be like this:
<input type="text" onkeypress="OnKeyPress(this)"...
where OnKeyPress is a javascript method, and this means your input control is passed in to it.
This[
^] is some documentation on js events.
Here[
^] is an example to allow only numeric key presses.
The problem you have is, when you use TextBoxFor, how do you get that code in there ? The answer is, an override of TextBoxFor that takes an anonymous collection of name value pairs which are then added as attributes to the element:
@Html.TextBoxFor(m => m.Product, new { @class = "normalcell", size = "38", maxlength = "255" })
This is from my own code, and it will emit this:
<input type="text" id="Product" class="normalcell" size="38" maxlength="255"/>
so, you would do this:
@Html.TextBoxFor(m=>m.shortDescription, new { @onkeypress="MyValidationMethod" })