【发布时间】:2014-01-10 02:12:02
【问题描述】:
我有三个不同的单选按钮项目,名称为“RegistrantType”。
根据用户的选择,显示不同的字段集。如何最有效地显示/隐藏字段集。我还需要禁用隐藏字段集中可能存在的任何 ASP.NET 验证:
<fieldset>
<legend id="legend">Registration</legend>
<ol>
<li>
<label for="RegistrantType">Please select your registrant type:</label>
<br />
<div id="RegistrantType">
<!-- Subscriber -->
<input runat="server" type="radio" name="RegistrantType" id="RegistrantTypeSubscriber" value="1" />
<label runat="server" for="SuspsectTypeSubscriber">Subscriber</label>
<fieldset runat="server" id="RegistrantTypeSubscriberFields">
<legend>
Subscriber
</legend>
<ol>
<li>
<input runat="server" type="text" name="RegistrantSubscriberID" placeholder="Subscriber ID" />
</li>
</ol>
</fieldset>
<!-- Promo -->
<input runat="server" type="radio" name="RegistrantType" id="RegistrantTypePromo" value="2" />
<label for="SuspsectTypePromo">Promo Code</label>
<fieldset runat="server" id="RegistrantTypePromoFields">
<legend>
Promo
</legend>
<ol>
<li>
</li>
</ol>
</fieldset>
<!-- New Sign Up -->
<input runat="server" type="radio" name="RegistrantType" id="RegistrantTypeNew Sign Up" value="3" />
<label for="SuspsectTypeNew Sign Up">New Sign Up</label>
<fieldset runat="server" id="RegistrantTypeNew Sign UpFields">
<legend>
New Sign Up
</legend>
<ol>
<li>
<input runat="server" type="text" name="RegistrantFirstName" id="RegistrantFirstName" placeholder="*First Name" maxlength="128" />
<input runat="server" type="text" name="RegistrantLastName" id="RegistrantLastName" placeholder="*Last Name" maxlength="128" />
<br />
<input runat="server" type="text" name="RegistrantPhoneNumber" id="RegistrantPhoneNumber" placeholder="*Phone Number" maxlength="14"/>
<br />
<input runat="server" type="text" name="RegistrantStreetAddress01" id="RegistrantStreetAddress01" placeholder="*Address" maxlength="128" />
<input runat="server" type="text" name="RegistrantStreetAddress02" id="RegistrantStreetAddress02" placeholder="Address" maxlength="128"/>
<br />
<input runat="server" type="text" name="RegistrantCity" id="RegistrantCity" placeholder="*City" maxlength="128" />
<asp:dropdownlist runat="server" id="RegistrantState"></asp:dropdownlist>
<input runat="server" type="text" name="RegistrantZIP" id="RegistrantZIP" placeholder="*ZIP Code" maxlength="10" />
</li>
</ol>
</fieldset>
</div>
</li>
<!-- Rest of form removed for brevity... -->
</ol>
</fieldset>
【问题讨论】:
-
第二个 URL 似乎有一些信息可以让我找到切换可见性的正确路径。不过,他们似乎都没有提到任何关于停用特定验证的内容。
标签: c# asp.net validation