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
SQL Server backup and shrink
Access VBA Expert needed - bookmarks amongst 2 recordsets, etc
hstbar.xla can not be found After Excel 2007 was installed
Run macro in background without blocking Excel input / output
Detect Open Form
Wsus WIndows 2003
Free Proxy Servers or Services
SQL Server 2005 Windows 7 64bit
somethine or a user is running sql profiler on my sql server 2008 instance - how can i identify the session
Options with Importing Pictures and Videos not functioning