Visual studio 魔法密码?!-。aspx字段丢失&从源代码中消失
我在处理.ASPX页面上的一些表单元素时遇到了一个非常奇怪的问题。。页面表单在单击div时有一个隐藏的幻灯片,允许用户“预订” 用于制作幻灯片动画的jQuery工作正常,只需单击勾选复选框id=rescheck即可 问题是,不是隐藏div中包含的所有字段都会在单击复选框时显示,从而与标签一起滑入视图,而是只显示一个文本字段输入,而不显示其他内容。检查源代码表明,这些缺少的标签和字段甚至不在源代码中,在MS Visual Studio 2008中查看和编辑时,显示在页面代码中 如您所见,字段及其标签似乎在浏览器中消失了!我不知道这是什么原因,也不知道下一步该怎么办 这是我的页面代码,来自Visual Studio:Visual studio 魔法密码?!-。aspx字段丢失&从源代码中消失,visual-studio,forms,asp.net,field,Visual Studio,Forms,Asp.net,Field,我在处理.ASPX页面上的一些表单元素时遇到了一个非常奇怪的问题。。页面表单在单击div时有一个隐藏的幻灯片,允许用户“预订” 用于制作幻灯片动画的jQuery工作正常,只需单击勾选复选框id=rescheck即可 问题是,不是隐藏div中包含的所有字段都会在单击复选框时显示,从而与标签一起滑入视图,而是只显示一个文本字段输入,而不显示其他内容。检查源代码表明,这些缺少的标签和字段甚至不在源代码中,在MS Visual Studio 2008中查看和编辑时,显示在页面代码中 如您所见,字段及其标
<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>
codebehind中是否有任何东西将任何控件的Visible属性设置为false?这会导致控件根本不在HTML中呈现,而不是将其置于不可见状态,这可能会让人非常困惑,因为许多人都不希望出现这种情况。我在文档结尾处有这样一点:我也尝试删除下面的脚本片段,但这与函数showmeit,box没有任何区别{var vis=box.checked?块:无;document.getElementByIdit.style.display=vis;}