Solved

How to change image within MS Ajax Accordion control header upon mouse click

Posted on 2008-06-13
2
2,350 Views
Last Modified: 2012-08-14
customer has requested that plus-sign / minus-sign images be used in individual accordion panel headers to indicate that the panel can be expanded or contracted.
The current ASPX code reads:
<Header><a href="" onclick="return false;"><strong>1. <em>Enable</em></strong> Access For New User</a></Header>
Am I right that this has to happen?
1.  Insert image with ID tag within the header.
2. Change the onclick event code to perform a real JavaScript function which changes the image's URL property.
3. Return false from the JavaScript function so as not to kill the normal Accordion operations.

Can anyone point me toward or supply a sample as how to make it work?

Thank you.
Richard
0
Comment
Question by:RichardKline
2 Comments
 
LVL 2

Accepted Solution

by:
Airyck666 earned 500 total points
ID: 21787103
This might work...
Adding background image to the styles you defined for the accordion headers.

For instance, if you defined the following css classes in your accorion initialization:
    HeaderCssClass="definedAccordianHeader"
    HeaderSelectedCssClass="definedAccordianSelectedHeader"

then you could make the following additions to the styles for those two classes (see comments for more info):
.definedAccordianHeader {

    background-image: url('collapse.png'); /* Point to your minus img */

    background-repeat: no-repeat;

    background-position: 4px 7px;   /* Adjust this (x y) to fix spacing of image within the line */

    padding-left: 18px; /* Adjust this for the starting point for the text in the header */

}
 

.definedAccordianSelectedHeader {

    background-image: url('expand.png'); /* Point to your plus img */

    background-repeat: no-repeat;

    background-position: 4px 7px;   /* Adjust this (x y) to fix spacing of image within the line */

    padding-left: 18px; /* Adjust this for the starting point for the text in the header */

}

Open in new window

0
 
LVL 1

Author Comment

by:RichardKline
ID: 21787348
This worked perfectly fine!
One minor correction.  Switch the Collapse/Expand images locations.   Expand belongs with default.  Collapsed belongs with the SelectedHeader.

This CSS solution is much preferred.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

863 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

25 Experts available now in Live!

Get 1:1 Help Now