tags:

views:

1565

answers:

4

Hello all,

I have a CollapsiblePanelExtender that will not collapse. I have "collapsed" set to true and all the ControlID set correctly. I try to collapse and it goes through the animation but then expands almost instantly. This is in an User Control with the following structure.

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
   <ContentTemplate>
      <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            DataSourceID="odsPartners" Width="450px" BorderWidth="0"
            ShowHeader="false" ShowFooter="false" AllowSorting="true" 
           onrowdatabound="GridView1_RowDataBound">
         <Columns>
            <asp:TemplateField HeaderText="Contract Partners" SortExpression="Name"> 
               <ItemTemplate>
                  <asp:Panel id="pnlRow" runat="server">
                     <table>
                          ...Stuff...
                     </table>
                  </asp:Panel>
                  <ajaxToolkit:CollapsiblePanelExtender runat="server" ID="DDE"
                              Collapsed="true" ImageControlID="btnExpander" ExpandedImage="../Images/collapse.jpg" CollapsedImage="../Images/expand.jpg"
                              TargetControlID="DropPanel" CollapseControlID="btnExpander" ExpandControlID="btnExpander" />
                  <asp:Panel ID="DropPanel" runat="server" CssClass="CollapsedPanel">
                     <asp:Table ID="tblContracts" runat="server">
                        <asp:TableRow ID="row" runat="server">
                           <asp:TableCell ID="spacer" runat="server" Width="30">&nbsp;</asp:TableCell>
                           <asp:TableCell ID="cellData" runat="server" Width="400">
                               <uc1:ContractList ID="ContractList1" runat="server" PartnerID='<%# Bind("ID") %>' />
                           </asp:TableCell>
                         </asp:TableRow>
                      </asp:Table>
                  </asp:Panel>
               </ItemTemplate>
            </asp:TemplateField>
          </Columns>
       </asp:GridView>
    </ContentTemplate>
   <Triggers>
       <asp:AsyncPostBackTrigger ControlID="tbFilter" EventName="TextChanged" />
   </Triggers>
</asp:UpdatePanel>
+3  A: 

I am sorry I do not have time to trouble-shoot your code, so this is from the hip.

There is a good chance that this a client-side action that is failing. Make certain that your page has the correct doctype tag if you took it out of your page or masterPage. Furthermore, attempt to set the ClientState as well:

DDE.ClientState = true;

The issue is you have that thing wrapped inside of your TemplateField. I have ran into issues using the AjaxControlToolkit on repeated fields and usually side with using a lighter weight client-side option, up to and including rolling your own show/hide method that can be reused just by passing in an DOM understood id.

Ian Patrick Hughes
A: 

Also check that the you have the following property set:

AutoExpand="False"

One of the features of the collapsible panel is that it will auto expand when you put your mouse over it, and this tag will make sure that doesn't happen.

Dillie-O
+1  A: 

After checking the AutoExpand (which strangley had no visible effect) I checked the DOC Type. Sure enough. That was the culprit.

This is the correct one:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" >

Thanks Ian!

Craig
A: 

Man. You chose that answer and still didn't give it a single "up vote"? Tough crowd. :)

Ian Patrick Hughes