2013-04-05 164 views
0

我有一個搜索頁面,它具有面板中的條件,當頁面打開時顯然沒有結果,頁面頁腳直接出現在搜索面板下方。如何將結果面板設置爲設置高度,然後將其拉伸至找到搜索結果時的網格高度。 乾杯設置頁面高度

<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" 
    CodeBehind="FrmSearch.aspx.cs" Inherits="web.FrmSearch" %> 

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> 
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"> 
    <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"> 
    </asp:ToolkitScriptManager> 
    <asp:UpdatePanel ID="pnlUpdate" runat="server" ChildrenAsTriggers="true"> 
     <ContentTemplate> 
      <div id="divSearch"> 
       <asp:Panel ID="pnlSearch" runat="server" DefaultButton="BtnSearch"> 
        <table width="100%"> 
         <tr> 
          <td> 
           <asp:Label ID="LblName" runat="server" Text="Name:" CssClass="head2"></asp:Label> 
          </td> 
          <td> 
           <asp:TextBox ID="TxtSurname" runat="server" Width="200" CssClass="norm"></asp:TextBox> 
          </td> 
          <tr> 
           <td> 
            <asp:Label ID="LblAddress" runat="server" Text="Address:" CssClass="head2"></asp:Label> 
           </td> 
           <td> 
            <asp:TextBox ID="TxtAddress" runat="server" Width="200" CssClass="norm"></asp:TextBox> 
           </td> 
          </tr> 
          <tr> 
           <td colspan="2" align="center"> 
            <asp:Button ID="BtnSearch" runat="server" Text="Search" OnClick="BtnSearch_Click" /> 
           </td> 
           <td colspan="2" align="center"> 
            <asp:Button ID="BtnReset" runat="server" Text="Reset" OnClick="BtnReset_Click" /> 
           </td> 
          </tr> 
        </table> 
       </asp:Panel> 
      </div> 
      <div> 
       <asp:Label ID="lblCount" runat="server" CssClass="head2"></asp:Label> 
      </div> 
      <hr /> 
      <div id="divResults"> 
       <asp:Panel ID="pnlResults" runat="server"> 
        <asp:GridView ID="gvResults" runat="server" AutoGenerateColumns="false" Width="99%" 
         CssClass="grd" OnRowDataBound="gvResults_RowDataBound"> 
         <Columns> 
          <asp:TemplateField HeaderText="Name"> 
           <ItemTemplate> 
            <asp:HiddenField ID="hfGUID" runat="server" Value='<%# Bind("GUID")%>' /> 
            <asp:Label ID="LblName" runat="server" Text='<%# Bind("Name") %>'></asp:Label> 
           </ItemTemplate> 
          </asp:TemplateField> 
          <asp:TemplateField HeaderText="Address"> 
           <ItemTemplate> 
            <asp:Label ID="LblAddress" runat="server" Text='<%# Bind("Address") %>'></asp:Label> 
           </ItemTemplate> 
          </asp:TemplateField> 
          <asp:TemplateField HeaderText="Post Code"> 
           <ItemTemplate> 
            <asp:Label ID="LblPostCode" runat="server" Text='<%# Bind("Post_Code") %>'></asp:Label> 
           </ItemTemplate> 
          </asp:TemplateField> 
          <asp:TemplateField HeaderText="Telephone"> 
           <ItemStyle Width="150px" /> 
           <ItemTemplate> 
            <asp:Label ID="LblTelephone" runat="server" Width="150px" Text='<%# Bind("Telephone") %>'></asp:Label> 
           </ItemTemplate> 
          </asp:TemplateField> 
         </Columns> 
        </asp:GridView> 
       </asp:Panel> 
      </div> 
     </ContentTemplate> 
     <Triggers> 
      <asp:AsyncPostBackTrigger ControlID="btnSearch" /> 
      <asp:AsyncPostBackTrigger ControlID="btnReset" /> 
     </Triggers> 
    </asp:UpdatePanel> 
</asp:Content> 
+0

難道你不能讓'div'在啓動時保持或顯示那部分隱形嗎? – MethodMan 2013-04-05 21:26:01

回答

0

您可以使用min-height:200pxdivSearch容器。

#divSearch 
{ 
    min-height:200px //according to your requirement 
} 
+0

謝謝工作:) – user1801525 2013-04-05 21:42:30