< Div Class = "Demoarea" >
< Div Class = "Demoheading" > Validatorcallout demonstration </ Div >
< Table >
< Tr >
< TD > Name: </ TD >
< TD > < ASP: textbox Runat = "Server" ID = "Nametextbox"
Borderstyle = "Solid" Borderwidth = "1px" Bordercolor = "# A9a9a9" /> </ TD >
</ Tr >
< Tr >
< TD > Phone number: </ TD >
< TD > < ASP: textbox Runat = "Server" ID = "Phonenumbertextbox"
Borderstyle = "Solid" Borderwidth = "1px" Bordercolor = "# A9a9a9" /> </ TD >
</ Tr >
</ Table >
< BR />
< ASP: requiredfieldvalidator Runat = "Server" ID = "Nreq"
Controltovalidate = "Nametextbox"
Display = "NONE"
Errormessage = "<B> required field missing </B> <br/> A name is required ." />
< Ajaxtoolkit: validatorcalloutextender Runat = "Server" ID = "Nreqe"
Targetcontrolid = "Nreq"
Highlightcssclass = "Validatorcallouthighlight" />
< ASP: requiredfieldvalidator Runat = "Server" ID = "Pnreq"
Controltovalidate = "Phonenumbertextbox"
Display = "NONE"
Errormessage = "<B> required field missing </B> <br/> A phone number is required. <Div style = 'margin-top: 5px; padding: 5px; Border: 1px solid # e9e9e9; Background-color: White; '> <B> other options: </B> <br/> <a href = 'javascript: Alert (& quot; no phone number available in profile. & quot;); '> extract from profile </a> </div>" />
< Ajaxtoolkit: validatorcalloutextender Runat = "Server" ID = "Pnreqe"
Targetcontrolid = "Pnreq"
Highlightcssclass = "Validatorcallouthighlight"
Width = "350px" />
< ASP: regularexpressionvalidator Runat = "Server" ID = "Pnregex"
Controltovalidate = "Phonenumbertextbox"
Display = "NONE"
Validationexpression = "(\ D {3 }\)?) | (\ D {3 }-))? \ D {3}-\ D {4 }"
Errormessage = "<B> Invalid Field </B> <br/> Please enter a phone number in the format: <br/> (###) ###-####" />
< Ajaxtoolkit: validatorcalloutextender Runat = "Server" ID = "Pnreqex"
Targetcontrolid = "Pnregex"
Highlightcssclass = "Validatorcallouthighlight" />
< ASP: button ID = "Button1" Runat = "Server" Text = "Submit" Onclick = "Button1_onclick" /> < BR /> < BR />
< ASP: updatepanel Runat = "Server" ID = "Up1" >
< Contenttemplate >
< ASP: Label ID = "Lblmessage" Runat = "Server" />
</ Contenttemplate >
< Triggers >
< ASP: asyncpostbacktrigger Controlid = "Button1" Eventname = "Click" />
</ Triggers >
</ ASP: updatepanel >
</ Div >
CS: Protected Void Button1_onclick ( Object Sender, eventargs E)
{< br> lblmessage. text = string . format ( " thanks {0 }, we'll give you a call at {1 }. " , nametextbox. text, phonenumbertextbox. text);
}