ValidatorCalloutExtender(验证提示)

< 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)
    
{
        lblMessage.Text 
= string.Format("Thanks {0}, we'll give you a call at {1}.", NameTextBox.Text, PhoneNumberTextBox.Text);
    }

转载于:https://www.cnblogs.com/ipusr/archive/2007/11/08/953409.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值