div内的Asp.Net Control没有出现在浏览器中

时间:2012-11-08 19:23:17

标签: asp.net

我有一张用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>

1 个答案:

答案 0 :(得分:0)

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