当 CollapsiblePanelExtender 折叠时调整 gridview 面板的大小
当 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>
I have the following javascript firing when the collapsiblepanelextender is collapsed or expanded.
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);
}
below is the panel I am trying to resize when the panel above is collapsed. Nothing happens to the gridview - my colapsible panel works great - however 'Panel2' does not appear to resize ????
<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>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论