我有以下標記。 errorPanel
第一次只用於顯示服務器端異常消息,並且正常工作。現在我想將我的驗證總結納入同樣的errorPanel
。現在當驗證摘要變爲可見時,使驗證摘要的容器可見
<asp:Panel ID="errorPanel" runat="server" CssClass="error" Visible="false">
<div style="float: right;">
<a href="#" class="error-close" style="font-size: 10px">Close</a></div>
<asp:Label ID="errorLabel" runat="server"></asp:Label>
<asp:ValidationSummary ID="validationSummary" runat="server" EnableClientScript="true" />
</asp:Panel>
<fieldset>
<legend>Create New Role</legend><asp:Label ID="newRoleNameLabel" runat="server" AssociatedControlID="newRoleNameText">Role Name:</asp:Label>
<asp:TextBox ID="newRoleNameText" runat="server" Width="100px"></asp:TextBox>
<asp:RequiredFieldValidator ID="newRoleNameRequired" runat="server" EnableClientScript="true" ControlToValidate="newRoleNameText" Display="Dynamic" ErrorMessage="Please enter a role name.">*</asp:RequiredFieldValidator>
<asp:Button ID="createButton" runat="server" Text="Create" OnClick="createButton_Click" />
</fieldset>
我的問題是必要的驗證情況客戶端,我想繼續保持,所以我沒有服務器端的機會,使errorPanel
可見,爲了使驗證摘要可見。
我看到我有兩個選擇:做驗證服務器端,並在那裏使用我的代碼使面板可見,或以某種方式掛接到客戶端代碼,並在應該使摘要顯示時捕獲事件,然後也使errorPanel
可見。我怎麼能去關於後者?
它有一個很好的厚臉皮給它。 – ProfK 2010-11-29 15:17:52