Ajax controltoolkit Learning Log-listsearchextender (14)

Source: Internet
Author: User
The listsearchextender control is used to quickly search and locate the content in the list. Applicable to the ListBox and dropdownlist controls.

See the example below:

1) Create an ASP. NET Ajax-enabled web project in vs2005 and name it listsearchextender1.

2) drag and drop a ListBox control and sqldatasource on the default. aspx page. Configure sqldatasource and use the productname field in products of northiwind. Set the datasourceid of ListBox to sqldatasouce1.

CodeAs follows: 1 < BR />
2 < ASP: ListBox ID = "Listbox1" Runat = "Server" Performanceid = "Sqlperformance1" Datatextfield = "Productname" Width = "250px" > </ ASP: ListBox > < BR />
3 < BR />
4 < ASP: sqldatasource ID = "Sqlperformance1" Runat = "Server" Connectionstring = "<% $ Connectionstrings: northwindconnectionstring %>"
5 Selectcommand = "Select [productname], [productid] from [alphabetical list of products] order by productname ASC" > </ ASP: sqldatasource >
6 < BR />

3) drag and drop a listsearchextender control on the page and set its attributes.

The Code is as follows: 1 < C0: listsearchextender ID = "Listsearchextender1" Targetcontrolid = "Listbox1" Promptcssclass = "Listsearchextenderprompt" Prompttext = "Input letters" Runat = "Server" >
2 </ C0: listsearchextender >

4) press Ctrl + F5 to view the effect in the browser.

As follows:

Note:
1) This control can be used with the ListBox and dropdownlist controls.
2) You cannot enter Chinese characters in the prompttext of the control (I cannot solve it at present). If you enter Chinese, a strange phenomenon will occur.

For example:

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.