Je suis très nouveau chez C Sharp. Dans Mon projet, je suis en train de concevoir une page de recherche où j'ai Text Box avec AJAX Control Auto Extender, J'utilise un service Web pour remplir la zone de texte (C'est la première fois que j'utilise Web Service, je ne sais pas ce que Web Service sera utilisé) lorsque l'utilisateur tape le mot dans la zone de texte. J'avais tout spécifié correctement, quand je cours mon programme et tape le mot il n'y a aucune réponse.AJAX Extendeur automatique complet avec service Web
Cette question peut ressembler à Dupliquer Question mais pas j'avais googled out beaucoup de temps vu de nombreux blogs élaborés avec les exemples montrés là mais aucun résultat. Quelqu'un me aide s'il vous plaît,
Mon code de service Web est,
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Data;
using System.Data.SqlClient;
using SubSonic;
using DataAccessLayer;
using System.Web.Configuration;
using System.Web.Services.Protocols;
using System.Xml.Linq;
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.Web.Script.Services.ScriptService]
public class Search : System.Web.Services.WebService
{
public void Autocomplete()
{
//Uncomment the following line if using designed components
//InitializeComponent();
}
[WebMethod]
public string[] GetCompletionList(string prefixText, int count)
{
if (count == 0)
{
count = 10;
}
DataTable dt = GetRecords(prefixText);
List<string> items = new List<string>(count);
for (int i = 0; i < dt.Rows.Count; i++)
{
string strName = dt.Rows[i][0].ToString();
items.Add(strName);
}
return items.ToArray();
}
public DataTable GetRecords(string strName)
{
string QueryString;
QueryString = System.Configuration.ConfigurationManager.ConnectionStrings ["IUMSNXG"].ToString();
using (SqlConnection obj_SqlConnection = new SqlConnection(QueryString))
{
using (SqlCommand obj_Sqlcommand = new SqlCommand())
{
obj_Sqlcommand.CommandType = CommandType.StoredProcedure;
obj_Sqlcommand.CommandText = "LRS_SP_CBFM_Sel";
obj_Sqlcommand.Connection = obj_SqlConnection;
obj_SqlConnection.Open();
obj_Sqlcommand.Parameters.AddWithValue("@animalCode", strName);
SqlDataAdapter dt = new SqlDataAdapter(obj_Sqlcommand);
DataSet ds=new DataSet();
dt.Fill(ds);
obj_SqlConnection.Close();
return ds.Tables[0];
}
}
}
}
Mon outil AJAX Script Manager est
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
<Services>
<asp:ServiceReference Path="~/Search.asmx" />
</Services>
</asp:ToolkitScriptManager>
Ma zone de texte et automatique Extender complet est,
<Anthem:TextBox ID="srchtxt" runat="server" AutoUpdateAfterCallBack="true"
Height="19px" Width="200px"></Anthem:TextBox>
<asp:AutoCompleteExtender ID="srchtxt_AutoCompleteExtender" runat="server"
CompletionInterval="100" DelimiterCharacters="" Enabled="True"
ServicePath="~/Search.asmx"
TargetControlID="srchtxt" UseContextKey="True"
ServiceMethod="GetCompletionList">
</asp:AutoCompleteExtender>
J'ai posté la saisie semi-automatique en utilisant jquery - http://deepumi.wordpress.com/2011/03/25/jquery-auto-completion-with -multiples-filés-dans-asp-net-c/ –
@ Deepu Dans ma place le site Wordpress est bloqué si U ne me dérange pas pourrait U poster ici ??? – Rajesh
pouvez-vous partager votre adresse e-mail .. Je peux vous envoyer le code de travail –