locked
AjaxControlToolkit CollapsiblePanel RRS feed

  • Question

  • User978918395 posted

     Hi,

     I'm trying to create a custom server control that will allow me to expand and collapse a panel using the ajaxcontroltoolkit. I also want to be able to RenderChildren within the panel. I have included what I have got so far. Any help would be greatly appreciated.

      

    1    Private Sub PagePreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender
    2                Dim cpRoundFrame As New AjaxControlToolkit.CollapsiblePanelExtender
    3                Dim pnlContent As New Panel
    4    
    5                pnlContent.ID = Me.UniqueID & "_Panel"
    6                pnlContent.CssClass = "paddedFrame"
    7    
    8                Controls.Add(pnlContent)
    9    
    10               'Output Ajax functionality
    11               cpRoundFrame.TargetControlID = Me.UniqueID & "_Panel"
    12               CPRoundFrame.ID = Me.UniqueID & "_CollapsePanel"
    13               cpRoundFrame.ExpandControlID = Me.UniqueID & "_CollapseImage"
    14               CPRoundFrame.CollapseControlID = Me.UniqueID & "_CollapseImage"
    15               CPRoundFrame.Collapsed = False
    16               CPRoundFrame.ImageControlID = Me.UniqueID & "_CollapseImage"
    17               CPRoundFrame.ExpandedImage = "~/images/collapse_blue.jpg"
    18               CPRoundFrame.CollapsedImage = "~/images/expand_blue.jpg"
    19               CPRoundFrame.SuppressPostBack = True
    20               CPRoundFrame.Page = MyBase.Page
    21               Controls.Add(CPRoundFrame)
    22   
    23           End Sub
    24           Protected Overrides Sub Render(ByVal output As HtmlTextWriter)
    25               Dim imgCollapse As New System.Web.UI.WebControls.Image
    26               imgCollapse.ID = Me.UniqueID & "_CollapseImage"
    27   
    28               Dim sbHeader As New StringBuilder
    29               sbHeader.Append("<div class=""TopLeft""></div><div class=""TopRight""></div>")
    30               sbHeader.Append("<div class=""Frame"">")
    31               sbHeader.Append("<div class=""FrameHeader"">")
    32               sbHeader.Append("<h3><span class=""icon_left " & IconClass & """>" & Header & "</span><a href=""#"">Click ME" & RenderControlToString(imgCollapse) & "</a></h3>")
    33               sbHeader.Append("<div class=""clear""></div>")
    34               sbHeader.Append("</div>")
    35               output.Write(sbHeader.ToString)
    36   
    37               'Panel start tag would go here
    38               RenderChildren(output)
    39               'Panel end tag would go here
    40   
    41               Dim sbFooter As New StringBuilder
    42               sbFooter.Append("</div>")
    43               sbFooter.Append("<div class=""BottomLeft""></div><div class=""BottomRight""></div>")
    44               sbFooter.Append("<div class=""clear""></div>")
    45   
    46               output.Write(sbFooter.ToString)
    47   
    48   
    49           End Sub
    
     
    Thursday, July 31, 2008 3:59 PM

All replies

  • User978918395 posted

     Surely someone can point me in the right direction?

    Saturday, August 2, 2008 7:44 AM