Click here to Skip to main content
15,898,371 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

I am trying to create a Collapsible Panel dynamically in asp.net vb. Following is my code:

VB
If dtmain.Rows.Count > 0 Then
            For i As Integer = 0 To dtmain.Rows.Count - 1

                Dim Main As New AjaxControlToolkit.CollapsiblePanelExtender
                Main.ID = "cp_" + i.ToString
                Main.CollapseControlID = "hp_" + i.ToString
                Main.CollapsedImage = "expand.gif "
                Main.ExpandControlID = "hp_" + i.ToString
                Main.ExpandedImage = "collapse.gif"
                Main.ImageControlID = "img" + i.ToString
                Main.TargetControlID = "Panel_" + i.ToString
                Main.Collapsed = True
                Me.up_menu.ContentTemplateContainer.Controls.Add(Main)

                Dim item As New MenuItem(dtmain.Rows(i)("group").ToString, "")
                str += "<table cellpadding='0' cellspacing='0' style='width: 279px'><tr><td style='width: 279px'>"
                str += "<div  runat="server"><asp:HyperLink ID='hp_" + i.ToString + "' runat='server' CssClass='handpoint' Font-Bold='True' Font-Names='Arial' Font-Size='10pt' Font-Underline='False' ForeColor='#333333' Width='205px'>" + dtmain.Rows(i)("group").ToString + "</asp:HyperLink>"
                str += "<asp:Image ID='img" + i.ToString + "' runat='server' ImageAlign='AbsMiddle' ImageUrl='~/collapse.gif' /></div></td></tr>"
                str += "<tr>"
                str += "<td style='width: 279px'>"
                str += "<asp:Panel ID='Panel_" + i.ToString + "' runat='server'>"
                str += "<table class='sampleStyleN' style='width: 265px'>"
                str += "<tr>"
                str += "<td style='width: 100px; height: 4px'>"
                str += "</td>"
                str += "</tr>"

and the rest of code follows, everything works fine, but the only problem is when i run the project, it says "The collapsible panel cannot find the TargetControlID"

Kindly help. Thank you
Posted
Comments
abhijeetgupta1988 16-Oct-12 9:23am    
the way you created Panels has the issue.

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