dimanche 28 juin 2015

Add space within foreach elements

i have two foreach operations nested like below.

@foreach (var post in Model.Posts)
  {
     <article class="post-@post.PostId @post.PostType sticky post-item isotope-item 
     @foreach (var category in post.Categories)
     {
       @category.FormattedCategoryName
     }">
  } 

Here's a sample of the output data:

<article class="post-1024 format-standard sticky post-item isotope-item cat1cat2cat3cat4cat5" style="width: 429px; position: absolute; left: 0px; top: 0px; transform: translate3d(2px, 1px, 0px);">

The only thing wrong is I could not separate @category.FormattedCategoryName with blank spaces. It might be an easy string operation but how? Any idea?

Thanks a lot.

Aucun commentaire:

Enregistrer un commentaire