Solved

Using AJAX CollapsiblePanelExtender

Posted on 2009-05-17
2
2,162 Views
Last Modified: 2012-05-07
Hello,

I am using a AJAX CollapsiblePanelExtender within a gridView on a webpage.
The page also contains a fieldset with some labels, a dropdown, 2 textboxes and a "submit" button.

Whenever the collapsible panel 'Plus' button (to expand) or the 'Minus' button are pressed - the controls on the page are slightly moving. That doesn't look so good and I would like to prevent that.

how can I do that?

Below is the code in my aspx page.

Thank you
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="view.aspx.cs" Inherits="InternalMonitorTool.ModuleLogger.view"%>

<%@ Register Tagprefix="calendarControl" Tagname="calendar" Src="../controls/calendar.ascx" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 

<html xmlns="http://www.w3.org/1999/xhtml" >

<head runat="server">

    <title>INTERNAL MONITOR TOOL</title>

    <LINK href="../css/style.css" type="text/css" rel="stylesheet">

  

    <script language="javascript" type="text/javascript">

        function copyToClipboard(str)

        {

            window.clipboardData.setData('Text' , str);

        }

    </script>

</head>

<body>

    <form id="form1" runat="server" submitdisabledcontrols="true">

    <asp:ScriptManager ID="ScriptManager1" runat="server" />

    <div>

         <table border="0" width="90%" cellpadding="0" cellspacing="0" style="margin-top:10px;margin-left:5px">

            <tr>

                <td align="center">

                    <fieldset  id="filters" runat="server">

                        <table border="0" width="100%">

                            <tr valign="top">

                                <td>

                                    <label for="cboComponents">Compnent:</label>

			                        <asp:DropDownList runat="server" ID="cboComponents" Width="180" style="z-index:0">

			                        </asp:DropDownList>

                                </td>

                                <td>

                                    <calendarControl:calendar id="calFrom" runat="server" LabelText="From: "></calendarControl:calendar>

                                </td>

                                <td>

                                    <calendarControl:calendar id="calTo" runat="server" LabelText="To: "></calendarControl:calendar>

                                </td>

                                <td>

                                    <asp:Button ID="btnSubmit" runat="server" CssClass="button" Text="Submit" OnClick="btnSubmit_Click" style="cursor:hand"/>

                                </td>   

                            </tr>

                        </table>

                    </fieldset>

                </td>

            </tr>

            <tr>

                <td>

                    <div id="divMessage" runat="server"></div>&nbsp;

                </td>

            </tr>

            <tr>

                <td>

                    <asp:GridView ID="gv" Runat="server" Width="100%" CellPadding="3"  

					        BorderWidth="1px" BorderColor="#003476" AutoGenerateColumns="False" AllowSorting="true" OnSorting="gv_Sorting">

					        <AlternatingRowStyle Font-Size="Small"  BackColor="#fafafa"></AlternatingRowStyle>

					        <RowStyle Font-Size="Small" HorizontalAlign="Left" BackColor="#e4eff1"></RowStyle>

					        <HeaderStyle Font-Size="Medium" Font-Italic="true" Font-Bold="True" Wrap="False" HorizontalAlign="Center" BackColor="#aaacbb"></HeaderStyle> 

                         <Columns>

                            <asp:TemplateField ItemStyle-VerticalAlign="Top" HeaderText="App Name" ItemStyle-Wrap="false" ItemStyle-Width="10px" SortExpression="appName">

				                <ItemTemplate>

                                    <asp:Label ID="lblAppName" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.appName")%>'>

                                    </asp:Label>

                                </ItemTemplate>

                            </asp:TemplateField>

                            <asp:TemplateField ItemStyle-VerticalAlign="Top" HeaderText="URL" ItemStyle-Wrap="false" ItemStyle-Width="5%">

				                <ItemTemplate>

                                    <asp:Label ID="lblURL" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.URL")%>'>

                                    </asp:Label>

                                </ItemTemplate>

                            </asp:TemplateField>

                            <asp:TemplateField ItemStyle-VerticalAlign="Top" HeaderText="" ItemStyle-Wrap="false">

				                <ItemTemplate>

				                    <ItemTemplate>

						                    <table width="100%">

						                        <tr valign="top">

						                            <td>    

						                                <asp:Panel ID="pnlTarget" runat="server">

                                                        <asp:Image ImageUrl="../images/plusViewDetails.gif" ID="imgCP" runat="server" />

                                                        </asp:Panel>

						                            </td>

						                            <td>

						                                <asp:Panel ID="ContentPanel" runat="server" style="overflow:hidden" Height="0"><%# DataBinder.Eval(Container, "DataItem.tblDateItem") %>

                                                        </asp:Panel>

						                            </td>

						                        </tr>

						                    </table>

                                            <ajaxToolkit:CollapsiblePanelExtender ID="cpe" runat="Server" 

                                                TargetControlID="ContentPanel"

                                                ExpandControlID="pnlTarget"

                                                CollapseControlID="pnlTarget" 

                                                Collapsed="false"

                                                CollapsedSize="0"

                                                ExpandedImage="../images/minus.gif"

                                                CollapsedImage="../images/plusViewDetails.gif"

                                                ImageControlID="imgCP"

                                                ExpandedText="expanded"

                                                CollapsedText="collapsed"

                                                ExpandDirection="Vertical">

                                            </ajaxToolkit:CollapsiblePanelExtender>

                                        </ItemTemplate>

                                </ItemTemplate>

                            </asp:TemplateField>

				        </Columns>

                    </asp:GridView>

                </td>

            </tr>

            

         </table>

    </div>

    </form>

</body>

</html>

Open in new window

0
Comment
Question by:Relegence
2 Comments
 
LVL 8

Accepted Solution

by:
ApexCo earned 500 total points
ID: 24412975
More than likely it has something to do with using the % width in your page instead of fixed width.

Try this instead. You will probably need to tweak the width and the styles a bit, but it may fix the problem.
<div style="margin-top:10px;margin-left:5px; width:800px">
 

	<div align="center">

    	

        <div id="wrap1">

        <fieldset  id="filters" runat="server">

        	<div>

                <label for="cboComponents">Component:</label>

                <asp:DropDownList runat="server" ID="cboComponents" Width="180" style="z-index:0"></asp:DropDownList>

            </div>

            <div> 

            	<calendarControl:calendar id="calFrom" runat="server" LabelText="From: "></calendarControl:calendar>

            </div>

            <div>

            	<calendarControl:calendar id="calTo" runat="server" LabelText="To: "></calendarControl:calendar>

            </div>

            <div>

            	<asp:Button ID="btnSubmit" runat="server" CssClass="button" Text="Submit" OnClick="btnSubmit_Click" style="cursor:hand"/>

            </div>

            </fieldset>

        </div>

        

        <div id="divMessage" runat="server"></div> 
 

	

    <div id="wrap2">

    	<div>

        	<asp:GridView ID="gv" Runat="server" Width="100%" CellPadding="3"  

                                                BorderWidth="1px" BorderColor="#003476" AutoGenerateColumns="False" AllowSorting="true" OnSorting="gv_Sorting">

                                                <AlternatingRowStyle Font-Size="Small"  BackColor="#fafafa"></AlternatingRowStyle>

                                                <RowStyle Font-Size="Small" HorizontalAlign="Left" BackColor="#e4eff1"></RowStyle>

                                                <HeaderStyle Font-Size="Medium" Font-Italic="true" Font-Bold="True" Wrap="False" HorizontalAlign="Center" BackColor="#aaacbb"></HeaderStyle> 

                         <Columns>

                            <asp:TemplateField ItemStyle-VerticalAlign="Top" HeaderText="App Name" ItemStyle-Wrap="false" ItemStyle-Width="10px" SortExpression="appName">

                                                <ItemTemplate>

                                    <asp:Label ID="lblAppName" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.appName")%>'>

                                    </asp:Label>

                                </ItemTemplate>

                            </asp:TemplateField>

                            <asp:TemplateField ItemStyle-VerticalAlign="Top" HeaderText="URL" ItemStyle-Wrap="false" ItemStyle-Width="5%">

                                                <ItemTemplate>

                                    <asp:Label ID="lblURL" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.URL")%>'>

                                    </asp:Label>

                                </ItemTemplate>

                            </asp:TemplateField>

                            <asp:TemplateField ItemStyle-VerticalAlign="Top" HeaderText="" ItemStyle-Wrap="false">

                                                <ItemTemplate>

                                                    <ItemTemplate>

                                                                    <table width="100%">

                                                                        <tr valign="top">

                                                                            <td>    

                                                                                <asp:Panel ID="pnlTarget" runat="server">

                                                        <asp:Image ImageUrl="../images/plusViewDetails.gif" ID="imgCP" runat="server" />

                                                        </asp:Panel>

                                                                            </td>

                                                                            <td>

                                                                                <asp:Panel ID="ContentPanel" runat="server" style="overflow:hidden" Height="0"><%# DataBinder.Eval(Container, "DataItem.tblDateItem") %>

                                                        </asp:Panel>

                                                                            </td>

                                                                        </tr>

                                                                    </table>

                                            <ajaxToolkit:CollapsiblePanelExtender ID="cpe" runat="Server" 

                                                TargetControlID="ContentPanel"

                                                ExpandControlID="pnlTarget"

                                                CollapseControlID="pnlTarget" 

                                                Collapsed="false"

                                                CollapsedSize="0"

                                                ExpandedImage="../images/minus.gif"

                                                CollapsedImage="../images/plusViewDetails.gif"

                                                ImageControlID="imgCP"

                                                ExpandedText="expanded"

                                                CollapsedText="collapsed"

                                                ExpandDirection="Vertical">

                                            </ajaxToolkit:CollapsiblePanelExtender>

                                        </ItemTemplate>

                                </ItemTemplate>

                            </asp:TemplateField>

                                        </Columns>

                    </asp:GridView>

               </div>	

               

          </div>

          

     </div>

Open in new window

0
 

Author Closing Comment

by:Relegence
ID: 31582379
Thanks!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now