I notice there is not a ValidationGroup property on controls such as WebCurrencyEdit and WebMaskEdit. What is the best method to group controls and validation required fields using the ASP.Net validation controls?
HI Joeg1005,
Yes our controls can be part of a ValidationGroup.
You can assign validators to our controls.These validators have a ValidationGroup property that you can assign to a group .
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
<%@ Register Assembly="Infragistics2.WebUI.WebDataInput.v7.3, Version=7.3.20073.38, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" Namespace="Infragistics.WebUI.WebDataInput" TagPrefix="igtxt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server"> <div> <igtxt:WebTextEdit ID="WebTextEdit1" runat="server"> </igtxt:WebTextEdit> <igtxt:WebNumericEdit ID="WebNumericEdit1" runat="server"> </igtxt:WebNumericEdit> <asp:TextBox ID="TextBox1" runat="server" ValidationGroup="group1"></asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox1" Display="None" ErrorMessage="RequiredFieldValidator" ValidationGroup="hello"></asp:RequiredFieldValidator> <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="WebNumericEdit1" Display="None" ErrorMessage="RequiredFieldValidator" ValidationGroup="hello"></asp:RequiredFieldValidator> <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="WebTextEdit1" Display="None" ErrorMessage="RequiredFieldValidator" ValidationGroup="hello"></asp:RequiredFieldValidator> <asp:Button ID="Button1" runat="server" Text="Button" ValidationGroup="hello" /> <asp:ValidationSummary ID="ValidationSummary1" runat="server" ValidationGroup="hello" /> <igtxt:WebCurrencyEdit ID="WebCurrencyEdit1" runat="server"> </igtxt:WebCurrencyEdit> <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="WebCurrencyEdit1" Display="None" ErrorMessage="RequiredFieldValidator" ValidationGroup="hello"></asp:RequiredFieldValidator> <igtxt:WebMaskEdit ID="WebMaskEdit1" runat="server"> </igtxt:WebMaskEdit> <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="WebMaskEdit1" Display="None" ErrorMessage="RequiredFieldValidator" ValidationGroup="hello"></asp:RequiredFieldValidator></div> </form></body></html>
Hi,
the WebMaskEdit causes validation, however the failed validation does not prevent it from posting back, so I see the "Ivalid Zip" error message, and then the posetback still occurs:
<igtxt:WebMaskEdit ID="groupZip" CssClass="textBoxEdit" InputMask="#####" Width="40px" runat="server"
AutoPostBack="true"
onvaluechange="groupZip_ValueChange"
CausesValidation="True" ></igtxt:WebMaskEdit>
<
asp:RegularExpressionValidator ID="validZipCode" runat="server"
ControlToValidate="groupZip"
EnableClientScript="true"
ValidationExpression="\w{5}"
Display="Dynamic"
/>