Solved

Set Unordered List attributes in page_load

Posted on 2012-03-14
6
333 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
[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
  • 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
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 
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

Want Experts Exchange at your fingertips?

With Experts Exchange’s latest app release, you can now experience our most recent features, updates, and the same community interface while on-the-go. Download our latest app release at the Android or Apple stores today!

Question has a verified solution.

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

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

617 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