Reputation: 85
I have a view in which I'm using passing viewmodel which has a property called FileName. This property is supposed to contain the file extension of a selected file however only the file extension shows. For example if the file name is Items.csv, then only "csv" will show up. Not ".csv", just "csv". I've tried to add the file extension in the property itself and also on the view by doing the following:
@Using (Html.BeginForm("CreatePrintJobStepLast", "Marketing"))
@<text>
<div class="section main">
File Name : @Html.Label(String.Format("{0}{1}", Model.FileName, ".csv"))
<br />
File Name : @Html.Label(String.Format("{0}.{1}", Model.FileName, "csv"))
<br />
File Name : @Html.Label(String.Format("{0}{1}{2}", Model.FileName, ".", "csv"))
</div>
</text>
End Using
I've tried a couple other ways, but the outcome is still the same. The user still sees "csv". Any help would be greatly appreciated and thank you in advance for taking time to look at my issue.
Upvotes: 0
Views: 195
Reputation: 8079
The first attribute of the Html.Label(...)
helper is used to fill the for
HTML attribute. So, you could have the following:
File Name : @Html.Label("", String.Format("{0}{1}", Model.FileName, ".csv"))
Upvotes: 1