AnneF
asked on
Ajax collapsible panel not collapsing
I have a serie of collapsible panels in a form, that are collapsed when the form is first open.
I have added a link button to collapse or open the panels. But for some reason I cannot make the panels collapse or open.
This is the code in my link button:
Protected Sub btnColPanel_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnColPanel.Click
NVar.bCollapsed = Not NVar.bCollapsed
If NVar.bCollapsed = True Then
Me.btnColPanel.Text = "Display assessment information"
Me.ColApp.Collapsed = True
Me.ColSaving.Collapsed = True
Me.ColCE.Collapsed = True
Else
Me.btnColPanel.Text = "Hide assessment information"
Me.ColApp.Collapsed = False
Me.ColCE.Collapsed = False
Me.ColSaving.Collapsed = False
End If
End Sub
I have tried to set the Causevalidation of the button to true or false, it did not work.
I have moved the second part of the code where the (panel collapsed) to the init, load and prerender of the form, it did not work.
Thanks for your help.
Anne
I have added a link button to collapse or open the panels. But for some reason I cannot make the panels collapse or open.
This is the code in my link button:
Protected Sub btnColPanel_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnColPanel.Click
NVar.bCollapsed = Not NVar.bCollapsed
If NVar.bCollapsed = True Then
Me.btnColPanel.Text = "Display assessment information"
Me.ColApp.Collapsed = True
Me.ColSaving.Collapsed = True
Me.ColCE.Collapsed = True
Else
Me.btnColPanel.Text = "Hide assessment information"
Me.ColApp.Collapsed = False
Me.ColCE.Collapsed = False
Me.ColSaving.Collapsed = False
End If
End Sub
I have tried to set the Causevalidation of the button to true or false, it did not work.
I have moved the second part of the code where the (panel collapsed) to the init, load and prerender of the form, it did not work.
Thanks for your help.
Anne
- Can you debug and tell me what's happen?
ASKER
It looks like it go through the code only once, and the variable changes everytime, the name of the button changes as well but the panel does not collapse/open.
I have difficulty to debug since I have started using the ajax controls as I get the following message:
There is no source code available for the current location, and a button to show disassembly.
I have difficulty to debug since I have started using the ajax controls as I get the following message:
There is no source code available for the current location, and a button to show disassembly.
Hello Annef,
Can u please let me know why do u want to do it in the code behind...
why dont u do somethig like the following:
<form id="form1" runat="server">
<asp:ScriptManager ID="Sc1" runat="server"></asp:Scrip tManager>
<div>
<asp:LinkButton ID="Lb1" runat="server" Text="Open" >
</asp:LinkButton>
<asp:Panel ID="Panel1" runat="server">
Panel1
</asp:Panel>
<cc1:CollapsiblePanelExten der ID="TestColl1" runat="server" TargetControlID="Panel1" CollapseControlID="Lb1" ExpandControlID="Lb1"
Collapsed="false" >
</cc1:CollapsiblePanelExte nder>
<asp:Panel ID="Panel2" runat="server">
Panel2
</asp:Panel>
<cc1:CollapsiblePanelExten der ID="CollapsiblePanelExtend er1" runat="server" TargetControlID="Panel2" CollapseControlID="Lb1" ExpandControlID="Lb1"
Collapsed="false" >
</cc1:CollapsiblePanelExte nder>
</div>
</form>
Can u please let me know why do u want to do it in the code behind...
why dont u do somethig like the following:
<form id="form1" runat="server">
<asp:ScriptManager ID="Sc1" runat="server"></asp:Scrip
<div>
<asp:LinkButton ID="Lb1" runat="server" Text="Open" >
</asp:LinkButton>
<asp:Panel ID="Panel1" runat="server">
Panel1
</asp:Panel>
<cc1:CollapsiblePanelExten
Collapsed="false" >
</cc1:CollapsiblePanelExte
<asp:Panel ID="Panel2" runat="server">
Panel2
</asp:Panel>
<cc1:CollapsiblePanelExten
Collapsed="false" >
</cc1:CollapsiblePanelExte
</div>
</form>
ASKER
I copied your code into a test form, however it does not recognise the asp:ScriptManager, message is: script manager is not a known element.
This is the html code I have:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Test.aspx.vb" Inherits="Test_Panel_Test" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register Assembly="AjaxControlToolk it" Namespace="AjaxControlTool kit" TagPrefix="ajaxToolkit" %>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form2" runat="server">
<asp:ScriptManager ID="Sc1" runat="server"/>
<div>
<asp:LinkButton ID="Lb1" runat="server" Text="Open" >
</asp:LinkButton>
<asp:Panel ID="Panel1" runat="server">
Panel1
</asp:Panel>
<ajaxToolkit:CollapsiblePa nelExtende r ID="TestColl1" runat="server" TargetControlID="Panel1" CollapseControlID="Lb1" ExpandControlID="Lb1"
Collapsed="false" >
</ajaxToolkit:CollapsibleP anelExtend er>
<asp:Panel ID="Panel2" runat="server">
Panel2
</asp:Panel>
<ajaxToolkit:CollapsiblePa nelExtende r ID="CollapsiblePanelExtend er1" runat="server" TargetControlID="Panel2" CollapseControlID="Lb1" ExpandControlID="Lb1"
Collapsed="false" >
</ajaxToolkit:CollapsibleP anelExtend er>
</div>
</form>
</body>
</html>
This is the html code I have:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Test.aspx.vb" Inherits="Test_Panel_Test"
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register Assembly="AjaxControlToolk
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form2" runat="server">
<asp:ScriptManager ID="Sc1" runat="server"/>
<div>
<asp:LinkButton ID="Lb1" runat="server" Text="Open" >
</asp:LinkButton>
<asp:Panel ID="Panel1" runat="server">
Panel1
</asp:Panel>
<ajaxToolkit:CollapsiblePa
Collapsed="false" >
</ajaxToolkit:CollapsibleP
<asp:Panel ID="Panel2" runat="server">
Panel2
</asp:Panel>
<ajaxToolkit:CollapsiblePa
Collapsed="false" >
</ajaxToolkit:CollapsibleP
</div>
</form>
</body>
</html>
ASKER
I managed to make the scriptmanager work, and I was able to test your solution, and it worked.
However, I have many collapsible panels, that can be open or closed separately. I want to be able to close/open them one a a time, when entering/viewing data, or all together at once.
In this case, your solution won't work for me, as the CollapseControlID and ExpandControlID is the link button at the top, so I won't be able to close/open one at a time.
Thanks for helping me finding a solution.
Anne
However, I have many collapsible panels, that can be open or closed separately. I want to be able to close/open them one a a time, when entering/viewing data, or all together at once.
In this case, your solution won't work for me, as the CollapseControlID and ExpandControlID is the link button at the top, so I won't be able to close/open one at a time.
Thanks for helping me finding a solution.
Anne
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you very much for your help