Try this ..
function OpenPane(paneIndex) {var accHost = $get(<AccordionID>).AccordionBehavior ;accHost.set_SelectedIndex( paneIndex );}The "AccordionBehavior" lets you access the methods as you would do with a BehaviorID.
Please mark my reply as an answer if this solves the issue
Thanks for the response. I added alerts to the javascript as shown below, because nothing was happening. The first alert works, but the second alert is never displayed.
function
OpenPane(paneIndex){
alert(paneIndex);
var accHost = $get('Accordion1').AccordionBehavior;
alert(accHost);
accHost.set_SelectedIndex( paneIndex );
}
What's wrong?
Hi,
If you dont get the second alert , you should have an error at the line $get('Accordion1').AccordionBehavior.
Can you check if $get('Accordion1') is a valid object .
change the code to be
functionOpenPane(paneIndex)
{
alert(paneIndex);
var accord = $get('Accordion1');
var accHost ;
if( accord != null)
{
accHost = accord.AccordionBehavior;
}
alert( accord );
alert(accHost);
accHost.set_SelectedIndex( paneIndex );
}
and also , what is the ID of the Accordion You are using , "Accordion1" ?
That code should work. If you're not getting to the second alert(), my guess is that "$get('Accordion1')" is returning null. Are you sure you have the correct ID of your Accordion?
If "Accordion1" is the server ID, you probably want: $get('<%= Accordion1.ClientID %>') in case the client ID is different (because it's inside a naming container, for example).
Excellent. Between Phanatic and Steve it is now working properly. Thanks very much, both of you.
Hi,
Need your help.
I am using the Accordion Panel. I have tried your code, but unfortunately couldnt get it to work.
I am getting error in accessing the property AccordionBehavior.
"accHost = accord.AccordionBehavior;"
accHostalways contain undefined value.
any help would be apprecitated..
Thanks in advance.
--Saurabh
.
No comments:
Post a Comment