I am using a Display Template in my C# MVC4 application to structure how I want my custom model to be displayed in a datatable within my view. For the datatable, Im using datatables.net. In the following code I give each <td>
the class name "aligned", but when I run the application and inspect element the class name assigned has a blank space at the end such as "aligned "
@using System;
@model MyProject.Models.CellValueViewModel
<td class="aligned">
@{if(Model.Value.StartsWith("<input type='checkbox'"))
{
@Html.Raw(Model.Value);
}
else if(Model.Value == String.Empty)
{
@Html.Encode(0.00);
}
else
{
@Html.DisplayFor(x => x.Value);
}
}
</td>
Can anyone provide why this is happening?
Depending on how you save your document, sometimes windows adds extra characters. Sometimes I see weird behavior like this in documents saved with UTF-8 encoding with signature.
1) To see if that's the cause of what you're experiencing, go to file->save as;
2) On the "Save" button click the down-arrow and select "Save with encoding"
3) make sure that utf8 without encoding is sellected. It's near the bottom. 4) make sure you don't select utf8 with encoding, which is near the top of the options.
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