I have the following code:
<div class="editor-field">
<%: Html.TextBoxFor(model => model.MyId) %>
<%: Html.ValidationMessageFor(model => model.MyId) %>
/div>
<
The 'MyId' property of the model is of type integer.
When the form is in 'Create' mode, MyId value is 0. How can I, prevent 0 displaying and rather render the textbox with an empty string / blank / no value?
I have tried various forms of String.Format without success.
You could use a nullable integer:
public int? MyId { get; set; }
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