Solved

Set Unordered List attributes in page_load

Posted on 2012-03-14
6
271 Views
Last Modified: 2012-03-14
I need to dynamically set the img src attributes of an unordered list in the page_load event.
How can I do this please in the sample list below?

        <div class="CarouSlide s3">
              <ul class="slider-holder">
                    <li id="no1c">
                          <img src="images/dashboard.jpg" width="50" height="50" />
                    </li>
                    <li id="no2c">
                          <img src="images/CO2a.jpg" width="50" height="50" />
                    </li>
                    <li id="no3c">
                          <img src="images/health.jpg" width="50" height="50" />
                    </li>
              </ul>
</div>
0
Comment
Question by:slimguy
  • 3
  • 2
6 Comments
 
LVL 96

Accepted Solution

by:
Bob Learned earned 250 total points
ID: 37719635
Since you have an HTML element, instead of server control, you could 1) add an "id" and runat="server" element, and reference the control, or 2) use JavaScript in <body> onLoad handler.
0
 
LVL 35

Expert Comment

by:YZlat
ID: 37719933
why not use JQuery? Why page_load event?
0
 
LVL 35

Expert Comment

by:YZlat
ID: 37719964
$("img").attr({  
  src: "/images/dashboard.jpg", 
  title: "Dashboard", 
  alt: "Dashboard alt" 
}); 

Open in new window

0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 35

Expert Comment

by:YZlat
ID: 37719983
    $(".slider-holder li").("img").attr({  
  src: "/images/dashboard.jpg", 
  title: "Dashboard", 
  alt: "Dashboard alt" 
}); 

Open in new window


or

    $(".slider-holder #no1c").("img").attr({  
  src: "/images/dashboard.jpg", 
  title: "Dashboard", 
  alt: "Dashboard alt" 
}); 

Open in new window

0
 

Author Closing Comment

by:slimguy
ID: 37721919
Thanks, that was the hint I needed!
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 37722548
I like the JQuery examples, too.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

757 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now