Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Regarding webservice with ajax autocomplete???

Regarding webservice with ajax autocomplete???

Scheduled Pinned Locked Moved ASP.NET
csharphtmldatabasedesignsysadmin
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Dotnetkanna
    wrote on last edited by
    #1

    Hi, Im using Webservice to implement autocomlpeteextender but im getting the folling error..any namespace i need to add or any changes have to do in the web config? im struggling? im getting the folling error.. Error 1 Attribute 'System.Web.Script.Services.ScriptService' is not valid on this declaration type. It is valid on 'class, interface' declarations only. Here the following code which i have used... ================================= using System; using System.Web; using System.Collections; using System.Web.Services; using System.Web.Services.Protocols; using System.Data; using System.Data.SqlClient; /// <summary> /// Summary description for Auto /// </summary> [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] public class Auto : System.Web.Services.WebService { public Auto () { //Uncomment the following line if using designed components //InitializeComponent(); } [WebMethod] public string HelloWorld() { return "Hello World"; } [System.Web.Script.Services.ScriptMethod] [System.Web.Script.Services.ScriptService] [WebMethod] public string[] GetCountryInfo(string prefixText) { SqlConnection con = new SqlConnection("uid=srp;pwd=12345;server=kagserver;"); //int count = 10; string sql = "select * from student_information Where s_Name like @prefixText"; SqlDataAdapter da = new SqlDataAdapter(sql, con); da.SelectCommand.Parameters.Add("@prefixText", SqlDbType.VarChar, 50).Value = prefixText + "%"; DataTable dt = new DataTable(); da.Fill(dt); string[] items = new string[dt.Rows.Count]; int i = 0; foreach (DataRow dr in dt.Rows) { items.SetValue(dr["s_Name"].ToString(), i); i++; } return items; } } ============================= <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Autocomplete.aspx.cs" Inherits="Autocomplete" %> <%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI" TagPrefix="asp" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    L 1 Reply Last reply
    0
    • D Dotnetkanna

      Hi, Im using Webservice to implement autocomlpeteextender but im getting the folling error..any namespace i need to add or any changes have to do in the web config? im struggling? im getting the folling error.. Error 1 Attribute 'System.Web.Script.Services.ScriptService' is not valid on this declaration type. It is valid on 'class, interface' declarations only. Here the following code which i have used... ================================= using System; using System.Web; using System.Collections; using System.Web.Services; using System.Web.Services.Protocols; using System.Data; using System.Data.SqlClient; /// <summary> /// Summary description for Auto /// </summary> [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] public class Auto : System.Web.Services.WebService { public Auto () { //Uncomment the following line if using designed components //InitializeComponent(); } [WebMethod] public string HelloWorld() { return "Hello World"; } [System.Web.Script.Services.ScriptMethod] [System.Web.Script.Services.ScriptService] [WebMethod] public string[] GetCountryInfo(string prefixText) { SqlConnection con = new SqlConnection("uid=srp;pwd=12345;server=kagserver;"); //int count = 10; string sql = "select * from student_information Where s_Name like @prefixText"; SqlDataAdapter da = new SqlDataAdapter(sql, con); da.SelectCommand.Parameters.Add("@prefixText", SqlDbType.VarChar, 50).Value = prefixText + "%"; DataTable dt = new DataTable(); da.Fill(dt); string[] items = new string[dt.Rows.Count]; int i = 0; foreach (DataRow dr in dt.Rows) { items.SetValue(dr["s_Name"].ToString(), i); i++; } return items; } } ============================= <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Autocomplete.aspx.cs" Inherits="Autocomplete" %> <%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI" TagPrefix="asp" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

      L Offline
      L Offline
      led mike
      wrote on last edited by
      #2

      Dotnetkanna wrote:

      im struggling? im getting the folling error..

      You're kidding right? I mean the error message explains exactly what the problem is so why are you asking about namespaces? :wtf:

      led mike

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups