I am using the default asp.net MVC 2 syntax to construct TextBox\'s which are integer or decimal for my asp.net MVC web app:
<%: Html.TextBoxFor(model =&g
Here is what you can do: (VB Code)
This is the core:
@IIf(Model.YourNumericValue = 0, "", Model.YourNumericValue)
Here is if you use the HTML to render your textbox
Here is if you use HTML helper to render you textbox
@Html.TextBox("sYourTextboxName", IIf(Model.YourNumericValue= 0, "", Model.YourNumericValue))
IIf is a very handy one line feature - the way it works is this.
IIf(Expression, TruePart, FalsePart)
So basically you saying - if my Parameter = 0 - I want to output nothing, String.Empty, Null, "" - and for the false part - it is like - oh if my Parameter does not equal to 0 - then that must be something other than 0 - so I will output the my numeric value without worrying that the zero will be in the textbox.
Or however you want to structure it.
Hope that helped!