Developing the ASP. Net Atlas server-side extender control -- writing server-side extender & dflying recent trends

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

PS: Thanks to everyone's love, I learned a lot in the two months of anjiayu in my blog, met many friends, and got a lot of opportunities. I have the honor to translate one copy.AtlasBooks:Foundations of Atlas: rapid Ajax development with ASP. NET 2.0It is estimated that it will be available at the People's post and telecommunications publishing house in three months. So this time is busy,BlogWe apologize for the frequent updates that have not been made before. Of course, you are welcome to continue the discussion.AtlasI will try my best to answer related questions.

In the next two monthsFoundations of AtlasI hope to keep improving, so there will be a lot of questions to discuss with you, such as terms and translation styles. Thanks in advance!

In the previous article (see:DevelopmentASP. NET AtlasServerExtenderWidget--Compile the clientBehavior).Behavior. In this articleArticle, Let's wrap it up and run it as a server-side control.

FirstValidateusernameproperties. CSFile, which inherits fromTargetcontrolpropertiesbase <control>Base class, which defines the ing between client property values and Server property values. At the same time,Targetcontrolpropertiesbase <control>Base class andAtlas control ExtenderThe client has been created for youXML scriptYou only need to define yourBehaviorThe required attributes.

Should JoinCheckresultlabelid,Servicename,Methodname,ValidmessageAndInvalidmessageFive attributes. For simplicity,Here is an example of only one attribute.

[Defaultvalue ( "" )]
[Idreferenceproperty ( Typeof (Webcontrol)]
[Requiredproperty ()]
Public   String Checkresultlabelid
{
Get
{
ReturnGetpropertystringvalue ("Checkresultlabelid");
}
Set
{
Setpropertystringvalue ("Checkresultlabelid", Value );
}
}

 

WhereCheckresultlabelidThree attributes are added before the definition:

    1. Defaultvalue: Set the default value of this attribute.
    2. Idreferenceproperty: Specifies that this attribute can only storeID.
    3. Requiredproperty: This attribute is required.

For other attributes, refer to the following source files.

Then let's take a look.Validateusernameextender. CSFile, the main part is as follows:

[Designer ( Typeof (Validateusernamedesigner)]
[Clientscriptresource ( " Dflying " , " Validateusernamebehavior " , " Dflying. Atlas. controltookit. validateusername. validateusernamebehavior. js " )]
[Requiredscript ( Typeof (Validateusernameextender)]
Public   Class Validateusernameextender: extendercontrolbase < Validateusernameproperties, control >
{
}

 

OurValidateusernameextenderInherited fromExtendercontrolbase <validateusernameproperties, control>Base class to get some common operations. Three attributes are applied to the class:

    1. Designer: Specify thisExtenderThe Class Name of the designer (used to provide support during the design period.
    2. Clientscriptresource: Specify to generate a clientAtlas XMLThe information required by the script. HereDflyingAndValidateusernamebehaviorAnd the precedingValidateusernamebehavior. js.
    3. Requiredscript: Specifies the script required by the client.AtlasTheAxdFile FormatValidateusernamebehavior. jsLink to the page.

FinallyValidateusernamedesigner. CSFile, here you can add support for the design periodProgram. Make your controlVisual StudioThe display style varies with the set attribute values. To simplify the process, I will not add support during the design period.

So far, ourExtenderJust write it.Release buildGenerated laterDLLYou can use it directly. In the next article, I will demonstrate how to apply thisExtender.

Related Article

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.