[2008] AJAX CollapsiblePanelExtender
I am attempting to use the CollapsiblePanelExtender but for some reason it never expands or collapses.. Do I need some codebehind for this tool to work?
Code:
<%@ Page Language="C#" MasterPageFile="MasterPage.Master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Default2" Title="Untitled Page" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="atk" %>
<asp:Content ID="cbody" runat="server" ContentPlaceHolderID="body">
<style type="text/css">
.cpBody
{
background-color: #DCE4F9;
font: normal 11px auto Verdana, Arial;
border: 1px gray;
width:450px;
height: 0px;
padding: 4px;
padding-top: 7px;
overflow:hidden;
}
</style>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="upLR" runat="server" >
<ContentTemplate>
<atk:CollapsiblePanelExtender
ID="cpe"
Runat="server"
TargetControlID="pBody"
CollapsedSize="0"
ExpandedSize="300"
Collapsed="True"
ExpandControlID="pHeader"
CollapseControlID="pHeader"
AutoCollapse="False"
AutoExpand="False"
ScrollContents="True"
TextLabelID="lblText"
CollapsedText="Show Details..."
ExpandedText="Hide Details"
ExpandDirection="Vertical" />
<asp:Panel ID="pHeader" runat="server">
<asp:Label ID="lblText" runat="server" Text="License Request" />
</asp:Panel>
<asp:Panel ID="pBody" runat="server" CssClass="cpBody">
<ul>
<li><a href="">Production</a></li>
<li><a href="">Pre-Production</a></li>
<li><a href="">Development</a></li>
</ul>
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
Re: [2008] AJAX CollapsiblePanelExtender
Does it throw any javascript errors when you click on it?
I also thought the script manager tag was supposed to be at the top of the page?
Oh, you're using a Masterpage. I'm afraid I'll be of little help in that area.
Re: [2008] AJAX CollapsiblePanelExtender
Do you have the ToolKitScriptManager on the masterpage ?
Re: [2008] AJAX CollapsiblePanelExtender
I hate that control. The jQuery slideToggle method is muuuuuuch smoother, easier to implement, and generates a lot less code, not to mention has a faster load time as there's no server control to be rendered. However, things I notice about your control definition:
AutoCollapse and AutoExpand are two properties I've never used... you don't need them.
ExpandedSize and CollapsedSize - also not needed. Use CSS to make the panel look like what you want, then set Collapsed=True. It knows that with nothing specified, Collapsed = not visible.
See if pulling those properties fixes anything.
Re: [2008] AJAX CollapsiblePanelExtender
I've tried putting the ToolKitScriptManager on both the default.aspx page and the masterpage, neither has worked. I don't even see the Expanded or Collapsed text appearing..
Re: [2008] AJAX CollapsiblePanelExtender
Did you try removing those extra properties that you don't need?
Re: [2008] AJAX CollapsiblePanelExtender
Yes I have removed the fields you suggested to remove... also note the collapsed property is set to true and the CSS is defined at the stop of the page
no text ever shows up on lblText and the panel pBody is always expanded
Re: [2008] AJAX CollapsiblePanelExtender
OK, this is going to sound crazy... try changing the TagPrefix of the Toolkit to "ajaxToolkit". I just recalled having a similar issue with the Toolkit where something that appeared syntactically correct just wasn't working, and using the default tag prefix fixed it for me... don't ask me why. Maybe you're just having the same issue.