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>
4

1 回答 1

0

您可以使用min-height:200px容器divSearch

#divSearch
{
  min-height:200px  //according to your requirement
}
于 2013-04-05T21:25:20.507 回答