CSS Display Template Extra Space in Class Name
Asked Answered
A

1

6

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?

Agna answered 13/4, 2013 at 14:45 Comment(1)
That should not be a problem in any browser – so why even bother?Runny
K
1

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.

Kilar answered 27/4, 2013 at 22:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.