I have two problems.
First
<ajax:AccordionPane ID="accPanePsalmsChapter1" runat="server" RequireOpenedPane="false" SuppressHeaderPostbacks="true" FadeTransitions="true" SelectedIndex="-1">
SelectedIndex does not work. Setting it to -1 or 0 does nothing. After page is loaded the selected index is always the last pane.
If I set Selected index on the back side in Page_Load then it works. But I should not have to.
Second
I have simple javascript that I have always used in prior sites and never had a problem. but in this case my accordion is always null.
the javascript
function setPaneIndex(accordionID, paneIndex) {
var acer = $find(accordionID + "_AccordionExtender");
if (acer != null && acer != "") { acer.set_SelectedIndex(acer.get_SelectedIndex() == paneIndex ? -1 : paneIndex); }
}
function getPaneIndex(accordionID) {
return $find(accordionID + "_AccordionExtender").get_SelectedIndex();
}the code on the page.
<ajax:Accordion ID="accPsalms" runat="server" SelectedIndex="1" RequireOpenedPane="false" ><Panes><ajax:AccordionPane ID="accPanePsalmsChapter1" runat="server" RequireOpenedPane="false" SuppressHeaderPostbacks="true" FadeTransitions="true" TransitionDuration="50" FramesPerSecond="30" SelectedIndex="-1"><Header>
Chapter 1<hr /></Header><Content><ol><li>item 1</li><li>item 2</li></ol></Content></ajax:AccordionPane><ajax:AccordionPane ID="accPanePsalmsChapter2" runat="server"><Header>
Chapter 2<hr /></Header><Content><ol><li>item 1</li><li>item 2</li></ol></Content></ajax:AccordionPane></Panes></ajax:Accordion><script>$(function () {
// var query = getQueryParams(document.location.search);
// if (query.v != "" && query.c != "") {
setPaneIndex('<%= accPsalms.ClientID %>', 0);
// }
});</script>