1

我有一张由 div 组成的表格。有一个主 div 作为表格,然后 div 作为表格单元格和表格行。在单元格内,我有一个标签和一个文本框。都是 Asp.Net 控件(文本框,标签)。除了一个特定的列之外,所有内容似乎都显示在浏览器中,我不知道为什么。“娘家姓”栏不会显示。

代码:

<div class="block">
           <div class="line">

                <div class="labelcell">
                    <asp:Label ID="lblPersonLastName" runat="server" Text="Last Name: "  meta:resourcekey="lblPersonLastNameResource1"/>
                </div>
                <div class="cell"> 
                    <asp:TextBox ID="txtPersonLastName" runat="server" MaxLength="200" Width="120px" meta:resourcekey="txtPersonLastNameResource1"/>
                </div>


                 <div class="labelcell">
                    <asp:Label ID="lblPersonDateOfBirth" runat="server" Text="Date of Birth:" meta:resourcekey="lblPersonDateOfBirthResource1"/>
                </div>
                <div class="cell">
                    <asp:TextBox ID="txtPersonDateOfBirth" runat="server" MaxLength="20" Width="120px" meta:resourcekey="txtPersonDateOfBirthResource1"/>
                    <asp:RegularExpressionValidator ID="regValDate" runat="server" ControlToValidate="txtPersonDateOfBirth" ErrorMessage="Date format must be YYYY/MM/DD or YYYY-MM-DD" ValidationExpression="(^[0-9]{4,4}(/|-)[0-1][0-9](/|-)[0-3][0-9]$)" ValidationGroup="AddPerson" meta:resourcekey="regValDateResource1">*</asp:RegularExpressionValidator>
                </div>

            </div>

            <div class="line">
               <div class="labelcell"> 
                    <asp:Label ID="lblPersonFirstName" runat="server" Text="First Name: " meta:resourcekey="lblPersonFirstNameResource1"/>
                </div>
                <div class="cell">    
                    <asp:TextBox ID="txtPersonFirstName" runat="server" MaxLength="200" Width="120px" meta:resourcekey="txtPersonFirstNameResource1"/>
                </div>

                <div class="labelcell">
                    <asp:Label ID="lblPersonAgeRange" runat="server" Text="Age Between:" meta:resourcekey="lblPersonAgeRangeResource1"/>
                </div>
                <div class="cell">
                    <asp:TextBox ID="txtPersonAgeRangeLow" runat="server" Width="30px" meta:resourcekey="txtPersonAgeRangeLowResource1"/>
                    &nbsp;<asp:Label ID="lblPersonAgeRangeAnd" runat="server" Text="and" Height="25px" meta:resourcekey="lblPersonAgeRangeAndResource1"/>&nbsp;
                    <asp:TextBox ID="txtPersonAgeRangeHigh" runat="server" Width="30px" meta:resourcekey="txtPersonAgeRangeHighResource1" />
                </div>
            </div>


            <div class="line">
                <div class="labelcell">
                     <asp:Label ID="lblPersonMiddleName" runat="server" Text="Middle Name: " meta:resourcekey="lblPersonMiddleNameResource1"/>
                </div>
                <div class="cell"> 
                    <asp:TextBox ID="txtPersonMiddleName" runat="server" MaxLength="128" Width="120px" meta:resourcekey="txtPersonMiddleNameResource1"/>
                </div>
                <div class="labelcell">
                    <asp:Label ID="lblPersonSex" runat="server" Text="Sex:" meta:resourcekey="lblPersonSexResource1"/>
                </div>
                <div class="cell">
                    <asp:RadioButton ID="rdbPersonSexMale" runat="server" AutoPostBack="True" OnDataBinding="SexChange" OnCheckedChanged="SexChange" GroupName="PersonSex" Text="Male " meta:resourcekey="rdbPersonSexMaleResource1"/>
                    <asp:RadioButton ID="rdbPersonSexFemale" runat="server" AutoPostBack="True" OnDataBinding="SexChange"  OnCheckedChanged="SexChange" GroupName="PersonSex" Text="Female " meta:resourcekey="rdbPersonSexFemaleResource1" />
                </div>
            </div>

            <div class="line">

            <div class="labelcell">
                <asp:Label ID="lblPersonStatus" runat="server" Text="Status:"  meta:resourcekey="lblPersonStatusResource1"/>
              </div>
              <div class="cell"> 
                 <asp:DropDownList ID="ddlPersonStatus" runat="server" AppendDataBoundItems="True" DataSourceID="dsPersonStatus" DataTextField="Status" DataValueField="StatusID" OnPreRender="ddlPersonStatus_PreRender" Width="120px" meta:resourcekey="ddlPersonStatusResource1">
                    <asp:ListItem Value="-1" meta:resourcekey="ListItemResource2">--Select--</asp:ListItem>
                </asp:DropDownList>
            </div>
                 <div class="labelcell">
                     <asp:Label ID="lblPersonMaidenName" runat="server" Text="Maiden Name:" meta:resourcekey="lblPersonMaidenNameResource1"/>
                </div>
                <div class="cell">
                     <asp:TextBox ID="txtPersonMaidenName" runat="server" MaxLength="200" Width="120px" meta:resourcekey="txtPersonMaidenNameResource1"/>
                </div>

            </div>

            <div class="line">
              <div class="labelcell">
                     <asp:Label ID="lblPersonThirdName" runat="server" Text="Third Name: " meta:resourcekey="lblPersonThirdNameResource1"/>
                </div>
                <div class="cell"> 
                    <asp:TextBox ID="txtPersonThirdName" runat="server" MaxLength="128" Width="120px" meta:resourcekey="txtPersonThirdNameResource1"/>
                </div>
                <div class="labelcell">
                    <asp:Label ID="lblPersonFps" runat="server" Text="FPS: "  meta:resourcekey="lblPersonFpsResource1"/>
                </div>
                <div class="cell"> 
                    <asp:TextBox ID="txtPersonFps" runat="server" MaxLength="200" Width="120px" meta:resourcekey="txtPersonFpsResource1"/>
                </div>
            </div> 
            <div class="line">
                <div class="labelcell">
                     <asp:Label ID="lblPersonForthName" runat="server" Text="Fourth Name: " meta:resourcekey="lblPersonForthNameResource1"/>
                </div>
                <div class="cell"> 
                    <asp:TextBox ID="txtPersonForthName" runat="server" MaxLength="128" Width="120px" meta:resourcekey="txtPersonForthNameResource1"/>
                </div>
                 <div class="labelcell">
                    <asp:Label ID="lblPersonEthnicity" runat="server" Text="Ethnicity:"  meta:resourcekey="lblPersonEthnicityResource1"/>
                 </div>
                <div class="cell">
                   <asp:DropDownList ID="ddlPersonEthnicity" Width="120px" runat="server" AppendDataBoundItems="True" DataSourceID="dsPersonEthnicity" DataTextField="Ethnicity" DataValueField="EthnicityID" OnPreRender="ddlPersonEthnicity_PreRender" meta:resourcekey="ddlPersonEthnicityResource1">
                        <asp:ListItem Value="-1" meta:resourcekey="ListItemResource1">--Select--</asp:ListItem>
                    </asp:DropDownList>
                 </div>

            </div> 
        </div>

这部分似乎不会出现在浏览器中:

                <div class="labelcell">
                     <asp:Label ID="lblPersonMaidenName" runat="server" Text="Maiden Name:" meta:resourcekey="lblPersonMaidenNameResource1"/>
                </div>
                <div class="cell">
                     <asp:TextBox ID="txtPersonMaidenName" runat="server" MaxLength="200" Width="120px" meta:resourcekey="txtPersonMaidenNameResource1"/>
                </div>

它在 HTML 中的显示方式(娘家姓部分):

<div class="labelcell"></div>

<div class="cell"></div>

这是确实出现的“线”:

<div class="line">
              <div class="labelcell">
                     <span id="lblPersonThirdName">Third Name: </span>
                </div>
                <div class="cell"> 
                    <input name="txtPersonThirdName" type="text" maxlength="128" id="txtPersonThirdName" style="width:120px;">
                </div>
                <div class="labelcell">
                    <span id="lblPersonFps">FPS: </span>
                </div>
                <div class="cell"> 
                    <input name="txtPersonFps" type="text" maxlength="200" id="txtPersonFps" style="width:120px;">
                </div>
            </div>
4

1 回答 1

0

将 Visible 属性设置为 false 的 ASP.NET 服务器控件不会呈现到页面 html。确保控件 lblPersonMaidenName 和 txtPersonMaidenName 在页面呈现之前可见。

于 2012-11-08T19:51:14.447 回答