CollapsiblePanelExtender折叠时调整gridview面板的大小

时间:2011-11-04 20:45:45

标签: javascript asp.net gridview collapsiblepanelextender

折叠或展开collapsiblepanelextender时,我有以下javascript触发。

function clickMe() {
  var collPanel = $find("CollapsiblePanelExtender2");
    if (collPanel.get_Collapsed()) {
        var H = "350px";
        var item = "Panel2";
        document.getElementById(item).height = H;
        //alert("c height: " + document.getElementById(item).height);
    }
    else {
        var H = "480px";
        var item = "Panel2";
        document.getElementById(item).height = H;
        //alert("not c height: " + document.getElementById(item).height);
    }
下面是我正在尝试在上面的面板折叠时调整大小的面板。 gridview没有任何反应 - 我的可压缩面板效果很好 - 但是'Panel2'似乎没有调整大小????

<asp:Panel ID="Panel2" runat="server" CssClass="pClick" ScrollBars="Vertical">
                    <asp:GridView ID="GridView1" runat="server" AllowSorting="True"  
                        OnRowDataBound="GridView1_RowDataBound" CssClass="dataTable2"  Height="100%"
                        OnSorting="GridView1_Sorting" style="text-align: center" 
                        AutoGenerateColumns="False" RowStyle-VerticalAlign="Bottom"  RowStyle-Height="30px">
                        <AlternatingRowStyle BackColor="#D3F0F8"/>
                        <HeaderStyle CssClass="header"  Width="98.5%"/>

                        <Columns>
                            <asp:BoundField HeaderText="Name" DataField="Name" SortExpression="name" ItemStyle-Width="20%" HeaderStyle-Width="20%"></asp:BoundField>
                            <asp:BoundField HeaderText="Address" DataField="Address1" SortExpression="address" ItemStyle-Width="15%" HeaderStyle-Width="15%"></asp:BoundField>
                            <asp:BoundField HeaderText="City" DataField="City" SortExpression="City" ItemStyle-Width="15%" HeaderStyle-Width="15%"></asp:BoundField>
                            <asp:BoundField HeaderText="State" DataField="State" SortExpression="State" ItemStyle-Width="6%" HeaderStyle-Width="6%"></asp:BoundField>
                            <asp:BoundField HeaderText="Zip" DataField="Zip" SortExpression="zip" ItemStyle-Width="6%" HeaderStyle-Width="6%"></asp:BoundField>
                            <asp:BoundField HeaderText="Region" DataField="Region" SortExpression="region" ItemStyle-Width="6%" HeaderStyle-Width="6%"></asp:BoundField>
                            <asp:BoundField HeaderText="Sales Rep" DataField="SalesRep" SortExpression="salesrep" ItemStyle-Width="20%" HeaderStyle-Width="20%"></asp:BoundField>
                            <asp:BoundField HeaderText="Rating" DataField="Rating" SortExpression="rating" ItemStyle-Width="6%" HeaderStyle-Width="6%"></asp:BoundField>
                            <asp:BoundField HeaderText="Num Vehicles" DataField="NumberVehicles" SortExpression="numbervehicles" ItemStyle-Width="6%" HeaderStyle-Width="6%"></asp:BoundField>
                            <asp:BoundField HeaderText="AdminId" DataField="AdminId" Visible="false"></asp:BoundField>
                            <asp:BoundField HeaderText="CrmId" DataField="CRMId" Visible="false"></asp:BoundField>
                            <asp:BoundField HeaderText="MasId" DataField="MasId" Visible="false"></asp:BoundField>
                        </Columns>
                    </asp:GridView>
                 </asp:Panel>

0 个答案:

没有答案