Barre horizontale de naviagtion

mercredi 19 janvier 2011

autocompleteExtender ajaxToolkit

WebService Code :AutoComplete.cs
le code à mettre dans le dossier app_code

using System;
using System.Collections.Generic;
using System.Web.Services;
using DataLayer;

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]

[System.Web.Script.Services.ScriptService]
public class AutoComplete : WebService
{
public AutoComplete()
{
}

[WebMethod]
public string[] GetCompletionList(string prefixText, int count)
{
List lstPublication =ClsLogicPublication.SelectAllEquipementPublication();
List PublicationArray = new List();
List list = lstPublication .FindAll(
delegate(ClsPublication pub)
{
return pub.IdPublication.ToString().ToLower().StartsWith(prefixText);
});
foreach(ClsPublication publ in list)
{
string item = AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(publ.IdPublication.ToString(), publ.DesignationPublication_FR.ToString());
PublicationArray.Add(item);
}
return PublicationArray.ToArray();

}
}


le code asmx du webservice :AutoComplete.asmx


<%@ WebService
Language="C#"
CodeBehind="~/App_Code/AutoComplete.cs"
Class="AutoComplete" %>


le code Aspx de la page :AutoComplete.aspx

















<%-- Collapse down to 0px and fade out --%>









le code css du panel autocomplete

.autocomplete_completionListElement
{
margin : 0px!important;
background-color : inherit;
color : windowtext;
border : buttonshadow;
border-width : 1px; border-style : solid;
cursor : 'default'; overflow : auto; height : 200px; text-align : left; list-style-type : none;
padding:0px;
}
/* AutoComplete highlighted item */
.autocomplete_highlightedListItem { background-color: #ffff99; color: black; padding: 1px; }

/* AutoComplete item */

.autocomplete_listItem { background-color : window; color : windowtext; padding : 1px; }



pour plus de détails voir ce lien
http://www.highoncoding.com/Articles/595_Implementing_Auto_Suggest_Using_AutoComplete

Aucun commentaire:

Enregistrer un commentaire