My Code
This Part Working Properly
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Services;
- using System.Data.SqlClient;
- using System.Configuration;
- using System.Web.Script.Services;
- namespace Product
- {
-
-
-
- [WebService(Namespace = "http://tempuri.org/")]
- [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
- [System.ComponentModel.ToolboxItem(false)]
-
- [System.Web.Script.Services.ScriptService]
- public class CustService : System.Web.Services.WebService
- {
- [WebMethod]
- [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
- public List<string> GetAutoCompleteData(string name)
- {
- List<string> result = new List<string>();
- using (SqlConnection con = new SqlConnection(@"Data Source=KARUKUVELRAJ-PC\SQLEXPRESS;Initial Catalog=Product;Integrated Security=True"))
- {
- using (SqlCommand cmd = new SqlCommand("select DISTINCT name from customer where name LIKE '%'+@SearchText+'%'", con))
- {
- con.Open();
- cmd.Parameters.AddWithValue("@SearchText", name);
- SqlDataReader dr = cmd.ExecuteReader();
- while (dr.Read())
- {
- result.Add(dr["name"].ToString());
- }
- return result;
- }
- }
- }
- }
- }
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="True">
</asp:ScriptManager>
<asp:TextBox ID="txtName" runat="server" Font-Bold="False" CssClass="form-control"></asp:TextBox>
<ajaxToolkit:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server" ServiceMethod="GetAutoCompleteData" CompletionInterval="10" EnableCaching="False" TargetControlID="txtName" ServicePath="~/CustService.asmx"> </ajaxToolkit:AutoCompleteExtender>
I Run This Code Not invoke it not Response, How to Clear this Problem