Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS Display Template Extra Space in Class Name

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?

like image 476
HendPro12 Avatar asked Apr 13 '13 14:04

HendPro12


1 Answers

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.

like image 142
Scott Terry Avatar answered Oct 01 '22 00:10

Scott Terry