Author: Dflying Chen ( Http://dflying.cnblogs.com/ )
For more information, see:UseASP. NET Atlas AutoComplete BehaviorOrAutoComplete ExtenderImplement the Automatic completion function (below)
Believe inAjaxAll the friends you know about the auto-completion function. (If you do not know about it, try it.Google suggest), Even a lot of friends are able to see the dazzling features it brings.AjaxInterested and start learning.ASP. NET AtlasIt also provides built-in and easy-to-use automatic support.
ASP. NET AtlasTwo methods are providedProgramThey provide the same functions, but have their own characteristics and applicability:
- ClientAutoComplete Behavior: Fully implemented using client scripts. Because it does not involve server-side control parsing, server resources are saved and otherAtlasClient controls are seamlessly integrated, but compared with beginners, it is difficult to learn and use them. In addition, it is difficult to adjust the client controls without the support of smart sensing during development. It is suitable for familiarityAtlasDevelopers from scratch to create "pure"AjaxProgram.
- ServerAutoComplete Extender: Use server-side controls. BecauseASP. NETControl model, which naturally gets the design periodIDESupport and compile-time check, familiarASP. NETDevelopers can easily get started. However, for client implementation, it is less efficient and not easy to communicate with other clients.AtlasControl Integration interaction. It is more suitable for adding "partial" for existing programs in small changes.AjaxAction.
Client AutoComplete BehaviorInherited fromSYS. UI. Behavior(AboutSYS. UI. BehaviorFor more information, see create a custom behavior in ASP. NET atlas ).AutoComplete BehaviorThe following attributes are available:
- Serviceurl: Server that provides the Automatic completion FunctionWeb Service.
- Servicemethod: The server that provides the Automatic completion FunctionWeb MethodName, whichWeb MethodThere should be a similar signature:Public String [] getsuggestions (string prefixtext, int count). WherePrefixtextThe string that is currently input by the client,CountReturns the maximum number of entries in the returned prompt list.StringArray, indicating the prompt list.
- Minimumprefixlength: Start to provide the minimum number of input characters in the automatically completed list text box. The default value is3. If you have just entered one or two letters, you can't wait to provide them with a long list. This makes no sense and wastes a lot of server and network resources. The suggestions provided are valuable only when the user inputs a value equal to or greater than a certain number (set by this attribute,AtlasThen, the system queries the corresponding method on the server and displays the prompt list to the user.
- Completioninterval: Interval between the backend queries. The default value is1000(MS ). If the value is too large, it will give the user the impression of slow program response. If the value is too small, it will increase the burden on the server and the network. Generally speaking,500-2000Is a reasonable value.
- Completionlist: DisplaysDomElement. If not specified,AtlasWill automaticallyTextboxCreateDiv. In general, we do not need to specify this attribute.
- Completionsetcount: Maximum number of items in the prompt list. The default value is10.
ServerAutoComplete ExtenderInherited fromExtendercontrol, Similar to, has the following attributes:
- servicepath : similar to client AutoComplete behavior serviceurl attribute.
- servicemethod : similar to clients AutoComplete behavior servicemethod attribute.
- dropdownpanelid : similar to client AutoComplete behavior completionlist attribute, however, the server side id . In general, we do not need to specify this attribute.
- minimumprefixlength : similar to client AutoComplete behavior minimumprefixlength attribute.
when using the server AutoComplete extender , you must specify at least one autocompleteproperties sub-control. autocompleteproperties controls are used to specify a specific textbox automatically added function, it also provides some attributes, including AutoComplete extender servicepath , servicemethod and minimumprefixlength three attributes. If you set AutoComplete extender and autocompleteproperties attribute, if this parameter is set to autocompleteproperties , the parameter is overwritten in AutoComplete extender .. autocompleteproperties provides the following attributes:
- Enabled: Whether to enable the auto-completion function. You should set itTrueTo enable automatic completion. The default value isFalse.
- Targetcontrolid: Specifies to which the auto-completion function will be appliedTextboxOn the server side.TextboxOfID.
Note: I am a little tired today. I would like to write the sample program tomorrow ...... Sorry
Note 2: The sample program has been completed:UseASP. NET Atlas AutoComplete BehaviorOrAutoComplete ExtenderImplement the Automatic completion function (below)