Automatic completion using ASP. NET Atlas AutoComplete Behavior or AutoComplete Extender (on) [from http://dflying.cnblogs.com

Source: Internet
Author: User

Author: Dflying Chen (http://dflying.cnblogs.com /)
For more information, see ASP. NET Atlas AutoComplete Behavior or AutoComplete Extender)

 

 

I believe that anyone who knows about AJAX knows about the auto-completion function (if you do not know about it, please try Google Suggest ), even a lot of friends are interested in AJAX only when they see the dazzling functions it brings and start learning. ASP. NET Atlas also provides built-in and easy-to-use automatic support.

ASP. NET Atlas provides two methods for Automatic completion in programs. They provide the same functions, but have their own characteristics and applicability:

  1. Client AutoComplete Behavior: Fully implemented using client scripts. It does not involve parsing server-side controls, which saves server resources and facilitates seamless integration with other Atlas client controls. However, compared with beginners, it is difficult to learn and use them, in addition, it is difficult to adapt without the support of smart sensing during development. It is suitable for developers familiar with Atlas to create "pure" AJAX programs from scratch.
  2. Server AutoComplete Extender: Use server-side controls. Because the ASP. NET control model is used, it is naturally supported by the IDE during the design period and checked during the compilation period. Developers familiar with ASP. NET can easily get started. However, for client implementation, it is less efficient and is not easy to integrate and interact with other client Atlas controls. It is more suitable for adding "partially" AJAX behavior to existing programs in small changes.

Client AutoComplete BehaviorInherited fromSys. UI. Behavior(For details about Sys. UI. Behavior, see create a custom Behavior in ASP. NET Atlas ). AutoComplete Behavior has the following attributes:

  1. ServiceURL: The path of the server-side Web Service that provides the Automatic completion function.
  2. ServiceMethod: The name of the Web Method on the server that provides the Automatic completion function. The Web Method should have 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.
  3. MinimumPrefixLength: Start to provide the minimum number of input characters in the automatically completed list text box. The default value is 3. 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, the corresponding method on the server is queried and displayed to the user prompt list.
  4. CompletionInterval: The interval between the query backend and the default value is 1000 (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,-is a reasonable value.
  5. CompletionList: Displays the DOM elements in the prompt list. If this parameter is not specified, Atlas automatically creates a DIV under the related TextBox for display. In general, we do not need to specify this attribute.
  6. CompletionSetCount: Maximum number of items in the prompt list. The default value is 10.

ServerAutoComplete ExtenderIt inherits from ExtenderControl. Similarly, it has the following attributes:

  1. ServicePath: Similar to the client AutoComplete BehaviorServiceURLAttribute.
  2. ServiceMethod: Similar to the client AutoComplete BehaviorServiceMethodAttribute.
  3. DropDownPanelID: Similar to the client AutoComplete BehaviorCompletionListAttribute, but the ID of the server <asp: Panel/> is specified here. In general, we do not need to specify this attribute.
  4. MinimumPrefixLength: Similar to the client AutoComplete BehaviorMinimumPrefixLengthAttribute.

When using the server-side AutoComplete Extender, you must specify at least oneAutoCompletePropertiesChild widget. The AutoCompleteProperties control is used to specify the auto-completion function for a specific TextBox. It also provides some attributes, includingServicePath,ServiceMethodAndMinimumPrefixLengthThree attributes. If you set an attribute in both AutoComplete Extender and AutoCompleteProperties, the setting in AutoCompleteProperties overwrites the setting in AutoComplete Extender. In addition, AutoCompleteProperties also provides the following attributes:

  1. Enabled: Whether to enable auto-completion. You should set it to true to enable auto-completion. The default value is false.
  2. TargetControlID: Specify the TextBox to which the auto-completion function will be applied, and set it to the ID of the TextBox on the server side.

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: use ASP. NET Atlas AutoComplete Behavior or AutoComplete Extender for Automatic completion (below)

 

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.