2

How would I go about populating a database value to my html body background ?
Simply put, the HTML code is something like:

<body background="<%=session("userLogo")%>">  

Update Clarification of my question: Where in the code-behind, should I make the database call to populate the session("userLogo") value ?

DNR
  • 3,706
  • 14
  • 56
  • 91
  • `` is malformed markup as there is no attribute userLogo (`background="session(" userLogo")"`) – be aware of doubled double quotes. Also, what should that background-value (`session…`) mean? – feeela Aug 18 '11 at 17:25
  • You can use a generic HTML control as described here: http://stackoverflow.com/questions/5066031/dynamic-background-image-on-body-asp-net – cgcarter1 Aug 18 '11 at 17:28

2 Answers2

3

Use this in your aspx:

body { background-image: url(<%= session("userLogo") %>); }

You can also put this in a css file (but then it has be an embedded resource and do remember to do performSubstitution = true)

Mrchief
  • 75,126
  • 20
  • 142
  • 189
0

Use <%= %>

<body background="<%= /* Code to retrieve value */ %>">
Brandon
  • 68,708
  • 30
  • 194
  • 223