views:

28

answers:

1

Im populating viewdata with a bunch of css style properties.

<span style="font-size:50pt; font-family:"<%= ViewData["font"]%>";"><%= ViewData["UserCopy"]%> </span>

i want to be able to do something similar to the above. i.e use the style put into viewdata and use them on inline styles.

how can i do this? thansk

+2  A: 

You have too many double quotes. Try this:

<span style="font-size:50pt; font-family:<%= ViewData["font"]%>;">
    <%= Html.Encode((string)ViewData["UserCopy"]) %>
</span>
Darin Dimitrov
in the source that returns : <span style="font-size:50pt; font-family: ;">
raklos
Probably because your ViewData does not contain a `font` property. Make sure that the controller action rendering this view populates this property: `ViewData["font"] = "Times New Roman";`
Darin Dimitrov
yep. you were right the first time. thanks
raklos