Microsoft
Software
Hardware
Network
Question : asp.net Why does'nt these required fields work. Only the Phone field works?
<%@ Page Language="VB" %>
http://www.w3.org/TR/xhtm
l1/DTD/xht
ml1-transi
tional.dtd
">
http://www.w3.org/1
999/xhtml"
>
Untitled Page
Company Name:
r ID="valName" Runat="server" ControlToValidate="txtName
" ValidationGroup="EventRegC
ontact"
CssClass="NormalRed" Display="Dynamic" EnableViewState="False"
ErrorMessage="You must enter a Name." />
Address:
r ID="valAddress" Runat="server" ControlToValidate="txtAddr
ess" ValidationGroup="EventRegC
ontact"
CssClass="NormalRed" Display="Dynamic" EnableViewState="False"
ErrorMessage="You must enter an Address." />
City:
r ID="valCity" Runat="server" ControlToValidate="txtCity
" ValidationGroup="EventRegC
ontact"
CssClass="NormalRed" Display="Dynamic" EnableViewState="False"
ErrorMessage="You must enter a City." />
Zip Code:
r ID="valZip" Runat="server" ControlToValidate="txtZip"
ValidationGroup="EventRegC
ontact"
CssClass="NormalRed" Display="Dynamic" EnableViewState="False"
ErrorMessage="You must enter a Zip Code." />
lidator ID="RegularExpressionValid
ator1"
runat="server" ErrorMessage="You must enter a valid Zip Code." ControlToValidate="txtZip"
ValidationGroup="EventRegC
ontact" ValidationExpression="\d{5
}(-\d{4})?
">gularExpre
ssionValid
ator>
Phone:
r ID="valPhone" Runat="server" ControlToValidate="txtPhon
e"
CssClass="NormalRed" Display="Dynamic" EnableViewState="False"
ErrorMessage="You must enter a Phone number." />
dator ID="RegularExpressionValid
ator2" runat="server" ControlToValidate="txtPhon
e" ValidationGroup="EventRegC
ontact"
ErrorMessage="You must enter a valid Phone Number. 555-555-5555" ValidationExpression="((\(
\d{3}\) ?)|(\d{3}-))?\d{3}-\d{4}">
larExpress
ionValidat
or>
Email:
r ID="valEmail" Runat="server" ControlToValidate="txtEmai
l" ValidationGroup="EventRegC
ontact"
CssClass="NormalRed" Display="Dynamic" EnableViewState="False"
ErrorMessage="You must enter an Email address." />
dator ID="RegularExpressionValid
ator3" runat="server" ControlToValidate="txtEmai
l" ValidationGroup="EventRegC
ontact"
ErrorMessage="You must enter a valid email in the form
[email protected]
." ValidationExpression="\w+(
[-+.']\w+)
*@\w+([-.]
\w+)*\.\w+
([-.]\w+)*
">gularExpre
ssionValid
ator>
Answer : asp.net Why does'nt these required fields work. Only the Phone field works?
thats because you have set ValidationGroup="EventRegC
ontact" for all but your Phone ReqFV and LinkButton.
Set ValidationGroup="EventRegC
ontact" for all involved Validators and the Linkbutton.
Random Solutions
Your user accounts are unexpectedly locked and event ID 12294 is logged in Windows Server 2003?
access 2007 frontend sql server 2008
Sending Object Via MessageQueue
How do you import outlook express 6 messages into Windows Live Mail and have them in the proper folders?
Cannot use remote executables after I upgraded to R2
How do I migrate Exchange 2003 Public Folder to Exchange 2007 using PFMigrate?
VPN client (Check point Secure client) not able to browse to any website on the machine once connected to the VPN.
Vista Boot Error
Append from Access to SQL Server key violation on any second query
Expert Notify Thread - For Experts only (those answering questions in the MS Access Zone).