Quick question - I want to pull in a different style sheet depending on the selection of a drop menu. The problem I am having is that I can pull in the field, but how do I stictch it into the html code in the header?
That will break the page because .css is not a procedure(not sure of correct terminology?) of Model so therefore break. It works fine with a space in (as expected).
For example:
@Model.colourScheme .css
How can I stitch @Model.colourScheme and the .css together?
I've tried + and && but can't seem to work it out - any help would be much appreciated!
Combining razor and html
Hey,
Quick question - I want to pull in a different style sheet depending on the selection of a drop menu. The problem I am having is that I can pull in the field, but how do I stictch it into the html code in the header?
Here's what I have so far:
That will break the page because .css is not a procedure(not sure of correct terminology?) of Model so therefore break. It works fine with a space in (as expected).
For example:
How can I stitch @Model.colourScheme and the .css together?
I've tried + and && but can't seem to work it out - any help would be much appreciated!
Thanks,
Tom
Hi Tom,
You could try something like this:
Hope this helps,
/Dennis
Works perfectly - thanks a lot Dennis!
Hi Tom
Have you tried writing it this way...
<link rel="stylesheet" type="text/css" href="(@Model.colourScheme +".css")" />
Hope this helps.
/Jan
Once again late to the party - Glad you got it solved :) #h5yr Dennis!
/Jan
Ninja'd at the last minute! :)
Thanks for the alternative response though
is working on a reply...