Hi,
I have a CustomValidator on my page. The validation is performed server-side. I have Save and Save & Close buttons which cause validation to fire. When I click the Save & Close button, everything works as expected and the error message shows if validation fails. However, no error message shows if I click on the Save button. Really strange.
Here's the relevant markup:
The validation code is being called when either button is clicked, and the validation fails, just no error message displaying when Save is clicked. Does anyone know why this might be?
Thx.
I have a CustomValidator on my page. The validation is performed server-side. I have Save and Save & Close buttons which cause validation to fire. When I click the Save & Close button, everything works as expected and the error message shows if validation fails. However, no error message shows if I click on the Save button. Really strange.
Here's the relevant markup:
Code:
<td>
<asp:TextBox ID="tbBackground" runat="server" CssClass="textfield" Width="100px" MaxLength="20" AutoPostBack="True"></asp:TextBox>
</td>
<td>
<asp:CustomValidator ID="cvBackground" runat="server" CssClass="rdnwarning" ErrorMessage="Please enter a valid hexadecimal color value (e.g. #0088DD) or valid standard color value (e.g. red)."
Display="Dynamic" ControlToValidate="tbBackground"></asp:CustomValidator> </td>
...
<td><span id="saveChanges" runat="server">
<asp:LinkButton ID="cmdSave" runat="server" CommandName="Save" OnCommand="Save">Save</asp:LinkButton>
<span class="bodyseparator">|</span> </span></td>
<td><span id="saveClose" runat="server">
<asp:LinkButton ID="cmdSaveClose" runat="server" CommandName="SaveClose" OnCommand="Save">Save & Close</asp:LinkButton>
<span class="bodyseparator">|</span> </span></td>
The validation code is being called when either button is clicked, and the validation fails, just no error message displaying when Save is clicked. Does anyone know why this might be?
Thx.