@Html.Label won't allow string concatination
- by MrGrigg
I'm building dynamic forms based on a partial view. My view inherits a model with a single property: CatalogName { get; set; }.
I have tried this:
@Html.Label(Model.CatalogName + "-ProductNumber", "Product Number")
@Html.TextBox(Model.CatalogName + "-ProductNumber")
The HTML renders like this though:
<label for>Product Number</label>
<input name="CatatalogName-ProductNumber" type="text" />
If I write my code like this:
@Html.Label("ProductNumber-" + Model.CatalogName", "Product Number")
It will render the way I expect
<label for="ProductNumber-CatalogName">Product Number</label>
Is this a bug with MVC? Are there any answers to why my concatenation won't work the way I want it in the label, but works fine with the TextBox?