[RESOLVED]HTML directly after an ASP call

So I’ve got what seemed like a simple issue, but I’ve yet to find the syntax to figure it out.

I want to use part of my model to change the class name of a div.

<div class="@module.FileType SmallIcon"></div>

The issue is, if Filetype="cvw", the code above gives me the class name "cvw SmallIcon" when I want "cvwSmallIcon"

I’ve tried using curlys, @:, line breaks, everything I can think of to get rid of the space. No luck. Obviously if I put SmallIcon right bside FileType, it treats it as the whole variable name and I get an error

What am I doing wrong?

You could try using the ViewBag to set something like ViewBag.FileClass = String.Format({0}{1}", module.Filetype, "SmalIcon")  Then use the ViewBag.FileClass to write it out in your div class.

adam3039

<div class="@module.FileType SmallIcon"></div>

Change the above to this:

<div class="@(module.FileType)SmallIcon"></div>

Leave a Reply