Click here to Skip to main content
15,887,380 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Is there any quick way to add an event handler on the server-side to an accordion control?
Posted

1 solution

Apparently you can hookup events by specifying the event and handler in the markup. (I say apparently as I do not actually have the control to play with at this moment.)

HTML
<cc1:Accordion
  ID="AccordionResults"
  runat="server"
  DataSourceID="SqlDataSourceResults"
  SelectedIndex="-1"
  RequireOpenedPane="false"
  FadeTransitions="true"
  HeaderCssClass="accordionHeader"
  HeaderSelectedCssClass="accordionHeaderSelected"
  ContentCssClass="accordionContent"
  Width="800px"

  OnItemCreated="InitPanes" />



And onItemCreated calls:

VB
Protected Sub InitPanes(ByVal sender As Object, ByVal e As AjaxControlToolkit.AccordionItemEventArgs)

        Dim myAccordionPane As AjaxControlToolkit.AccordionContentPanel = CType(e.AccordionItem, AjaxControlToolkit.AccordionContentPanel)
        Dim workAroundLabel As New Label
        workAroundLabel.Visible = False
        myAccordionPane.Controls.Add(workAroundLabel)

End Sub
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900