Develop the ASP. Net Atlas server extender control-use the compiled control in actual development

Source: Internet
Author: User
Author: Dflying Chen ( Http://dflying.cnblogs.com/ )

PS: I haven't updated it for a long time. Sorry ...... I hope you will continue to support me.

In the previous articles of this series (DevelopmentASP. NET AtlasServerExtenderWidget--Basic concepts and pre-Requirements,DevelopmentASP. NET AtlasServerExtenderWidget--Compile the clientBehavior,DevelopmentASP. NET AtlasServerExtenderWidget--Write ServerExtender & dflyingRecent trends), We have developedAtlasServerExtenderControl. This article is the last one. It describes how to use the previously written control.

First, createAtlas web site, And add reference to the Control compiled above. See:

Then, writeWeb ServiceHere, I simply assume that the user name cannot be obtained.Dflying. Of course, in the specific implementation, You can query and verify from the database. Save itUserregisterservice. asmx:

[WebService (namespace =   " Http://www.dflying.net/ " )]
[Webservicebinding (conformsto = Wsiprofiles. basicprofile1_1)]
Public   Class Userregisterservice: system. Web. Services. WebService {

[Webmethod]
Public   Bool Checkusername ( String Usernamecandidate) {< br> If (usernamecandidate = " dflying " )
return false ;< br> return true ;< BR >}
}

Then, addAtlasOfScriptmanager:

< Atlas: scriptmanager ID = "Scriptmanager1" Runat = "Server"   />

AddTextbox, Used to enter the user name;LabelTo display the verification results. Note that both controls areASP. NETThat is, you can use the WYSIWYG development method.ToolboxDrag them to the page.ASP. NETThe development model is the same.

< ASP: textbox ID = "Textbox1" Runat = "Server" > </ ASP: textbox >
< ASP: Label ID = "Label1" Runat = "Server" > </ ASP: Label >

Then it is the core part of the instance,Validateusernameextender. Enter the followingCodeTo specify the properties of our controls. Of course, if you want to, you can also add it to toolbox and drag it to the page.

< Dflying: validateusernameextender ID = "Validateusername" Runat = "Server" >
< Dflying: validateusernameproperties Checkresultlabelid = "Label1" Targetcontrolid = "Textbox1"
Servicename = "Userregisterservice. asmx" Methodname = "Checkusername" Validmessage = "You can use this User Name ."
Invalidmessage = "This user name has already been used, please choose another ."   />
</ Dflying: validateusernameextender >

Note thatIDESmart sensing:

All optional properties are listed in the Properties window, which greatly accelerates our development:

In the browser, test the user name that can be used:

Unavailable User Name:

ValidateusernameextenderThis exampleProgramThe code can be downloaded here: http://files.cnblogs.com/dflying/ValidateUserName.zip

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.