开发者

auto complete Extender not calling the webservice method

auto complete Extender not calling the webservice method ...

the exact problem is ., Am using AutoComplet Extender in Example project its working fine .. but the same code(aspx code as well as webservice code) am using in my live project its not calling the web service method ...

my live project is dotnet 2.0 version

i mention my code bellow steps

  • aspx Code

  • asmx code

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

  • asmx.cs

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

using System;
using System.Collections.Generic;
using System.Web;
using System.Web.Services;
using System.Data.SqlClient;
using System.Data;

/// <summary>
/// Summary description for WebServiceGetDoctor
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class WebServiceGetDoctor : System.Web.Services.WebService {
public WebServiceGetDoctor () {

    //Uncomment the following line if using designed components 
    //InitializeComponent(); 
}

[System.Web.Services.WebMethod]
public string[] GetDoctorName(string prefixText, string contextKey)
{
    string target = contextKey;
    SqlConnection sqlconn = new SqlConnection(@"Data Source=ABMSPLWINSRV2\ABMSPL;Initial Catalog=VivusHIS;Persist Security Info=True;User ID=sa; pwd=Bgs2000new");

    SqlCommand sqlcmd = new SqlCommand();
    sqlcmd.Comma开发者_StackOverflowndType = CommandType.StoredProcedure;
    sqlcmd.CommandText = "SerchGetDoctorDetails";
    SqlParameter p = new SqlParameter();
    sqlcmd.Connection = sqlconn;
    p = sqlcmd.Parameters.AddWithValue("@prefixText", prefixText);
    p = sqlcmd.Parameters.AddWithValue("@target", target);
    SqlDataAdapter da = new SqlDataAdapter(sqlcmd);
    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[target].ToString(), i);

        if (i != 10)
        {
            i++;
        }

    }
    return items;
}

}


Did you try Class="WebServiceGetDoctor" instead of Class="WebService"


Add this line

[System.Web.Script.Services.ScriptService]

after the line

[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜