我有一个非常奇怪的&我正在处理的.ASPX页面上的某些表单元素的奇怪问题...页面表单上有一个隐藏的幻灯片,点击一个div,允许用户“预订”。
用于动画幻灯片的jQuery工作正常,点击勾选复选框(id =“rescheck”)就会发生。
问题是,在点击复选框时显示隐藏div中包含的所有字段,并因此滑入视图及其标签,只显示一个文本字段输入,而不显示任何其他内容。检查源代码显示这些丢失的标签和&字段甚至不在源代码中,在MS Visual Studio 2008中查看(和编辑)时,它们位于页面代码中。
正如您所看到的,字段及其标签似乎只是在浏览器中消失了!我不知道是什么引起了这种情况,我不确定下一步该怎么做。
这是我的PAGE代码,来自Visual Studio:
<fieldset id="resreq">
<legend>Make a Reservation?</legend>
<label for="rescheck" class="rescheck">If you would like to reserve a table at Madrasi check here:</label>
<input id="rescheck" type="checkbox" class="rescheck" runat="server" />
<div id="reservationfields">
<div id="res_when">
<div>
<asp:Label ID="lblDate" runat="server" AssociatedControlID="txtDate">On which date would you like us to reserve your table?</asp:Label>
<asp:TextBox ID="txtDate" runat="server" CssClass="res_date" />
</div>
<div>
<asp:Label ID="lblTime" runat="server">and for what time?</asp:Label>
<asp:TextBox ID="txtTime" runat="server" CssClass="res_time" />
</div>
</div><!-- close res_when -->
<div>
<asp:Label ID="lblBranch" runat="server">At which restaurant would you like to make your reservation?</asp:Label>
<asp:DropDownList ID="ddlBranch" runat="server">
<asp:ListItem Text="Select a Restaurant" Value="" />
<asp:ListItem Text="Restaurant 1" Value="Restaurant 1" />
<asp:ListItem Text="Restaurant 2" Value="Restaurant 2" />
</asp:DropDownList>
</div>
<div>
<asp:Label ID="lblPeople" runat="server" AssociatedControlID="txtPeople" Text="Number of Guests:" />
<asp:TextBox ID="txtPeople" runat="server" />
</div>
<div>
<asp:Label ID="lblDOB" runat="server" AssociatedControlID="txtDOB">Date of Birth:</asp:Label>
<asp:TextBox ID="txtDOB" runat="server" />
</div>
</div><!-- close reservation fields -->
</fieldset>
...当您在浏览器中查看“来源”时,这是源代码:
<fieldset id="resreq">
<legend>Make a Reservation?</legend>
<label for="rescheck" class="rescheck">If you would like to reserve a table at Madrasi check here:</label>
<input name="ctl00$cpcMain$rescheck" type="checkbox" id="ctl00_cpcMain_rescheck" class="rescheck" />
<div id="reservationfields">
<div id="res_when">
<div>
<input name="ctl00$cpcMain$txtDate" type="text" id="ctl00_cpcMain_txtDate" class="res_date" />
</div>
<div>
</div>
</div>
<div>
</div>
<div>
</div>
<div>
<span id="ctl00_cpcMain_rvDOB" style="color:Red;visibility:hidden;">You have entered your Date of Birth incorrectly (dd/mm/yyyy).</span>
</div>
</div><!-- close reservation fields -->
</fieldset>
答案 0 :(得分:0)
代码隐藏中是否有任何内容将任何控件的 Visible 属性设置为false?这导致控件根本不在HTML中呈现,而不是将它们置于不可见的状态,这可能会让人很困惑,因为许多人不会期望这样。