Solved

asp.net VB set background image of div tag in code behind

Posted on 2010-09-20
3
1,871 Views
Last Modified: 2012-05-10
Hi, I have a div tag and I want to set it's background image in my code behind file. How would I do this? Below is what I currently have, but it is not working. Thanks

Page:
<div class="image_bg" id="image_bg" runat="server">     <<<<<<<<<<<<<<< want to set this bg image
  <div id="menuwrapper">  
    <div id="menu">  
      <div class="menuitem">asdfasdfsf k jlkj kl; kl lkj l;k jlk jkl kl asdfasdfsf k jlkj kl; kl lkj l;k jlk jkl kl asdfasdfsf k jlkj kl; kl lkj l;k jlk jkl kl asdfasdfsf k jlkj kl; kl lkj l;k jlk jkl kl asdfasdfsf k jlkj kl; kl lkj l;k jlk jkl kl asdfasdfsf k jlkj kl; kl lkj l;k jlk jkl kl asdfasdfsf k jlkj kl; kl lkj l;k jlk jkl kl asdfasdfsf k jlkj kl; kl lkj l;k jlk jkl kl asdfasdfsf k jlkj kl; kl lkj l;k jlk jkl kl asdfasdfsf k jlkj kl; kl lkj l;k jlk jkl kl asdfasdfsf k jlkj kl; kl lkj l;k jlk jkl kl </div><!--Template for each menu item-->  
      </div>  
   </div>
</div>  

Code Behind:
Partial Class vertical_test
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        image_bg.background-image = "url(main_slides/slide1.jpg)")
    End Sub
End Class
0
Comment
Question by:elliottbenzle
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 33719275
I believe you'll need to use the Style property of the div:
Me.image_bg.Style.Add("background-image", "url(main_slides/slide1.jpg)")

Open in new window

0
 
LVL 4

Author Closing Comment

by:elliottbenzle
ID: 33719539
YES! Thank you very mucho.
0
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 33719580
NP. Glad to help  :)
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question