帮助我查找代码中的错误,我的ajax无法正常工作 [英] help me for finding the error in my code, my ajax is not working

查看:72
本文介绍了帮助我查找代码中的错误,我的ajax无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我以前也使用过此代码,并且我自动完成的扩展程序也很好用.但是现在我尝试这样做,然后我的自动完成扩展器无法正常工作.有人可以帮助我吗?我搜索了很多网站,现在iam发布了我在我的项目中使用的代码.


i used this code previously also and my auto completed extender works good. but now i try this then my autocomplete extender is not working . can anybody plz help me . i search so many website , now iam posting my code which iam used in my project.


<asp:ScriptManager ID="ScriptManager1" runat="server">
            </asp:ScriptManager>





<asp:TextBox ID="TextBox11" runat="server"

              ontextchanged="TextBox11_TextChanged" Width="127px" ></asp:TextBox>

         <asp:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server"

          TargetControlID="TextBox11" EnableCaching="true" MinimumPrefixLength="1"

          FirstRowSelected="true" CompletionInterval="10" DelimiterCharacters="" Enabled="True"

            ServiceMethod="GetCompletionList" UseContextKey="True" BehaviorID="Autocompletelist">
          </asp:AutoCompleteExtender>



和使用C#的代码



and code behind using C#

SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["abcdConnectionString"].ConnectionString);
        con.Open();
        string strQuery = "select spare_name from spare_part_name where spare_name like '" + prefixText + "%'";
        DataSet ds = new DataSet();
        SqlDataAdapter da = new SqlDataAdapter(strQuery, con);
        da.Fill(ds);
        con.Close();
        List<string> sparename = new List<string>();
        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
        {
            sparename.Add(ds.Tables[0].Rows[i][0].ToString());
        }
        return sparename.ToArray();





请参阅我使用的代码并给出答案.





see the code which i used and give me the answers.

推荐答案

尝试使用此链接可能会对您有所帮助

http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/AutoComplete/AutoComplete.aspx [ ^ ]
Try this link may help you

http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/AutoComplete/AutoComplete.aspx[^]


Ravimcts,

在您的Web方法GetCompletionList()页面中,您只需取消注释如下所示.
[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]

我想它将与您的代码一起使用..
Hi Ravimcts,

In your Web method GetCompletionList() page you just uncomment the line showning below..

[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]

I thing it will work with your code..


这篇关于帮助我查找代码中的错误,我的ajax无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆