自动完成扩展器不会在文本框中显示值 [英] autocomplete extender doesnt show the values in textbox

查看:98
本文介绍了自动完成扩展器不会在文本框中显示值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我在应用程序中使用自动完成扩展器.控件未在文本框中提供值.并且我正在使用Web服务获取值.

这是我的网络方法代码和设计代码

Hi
I am using autocomplete extender in my application.the control doesnt giving the values in textbox.And i am using webservice to get the values.

this my web method code and design code

[WebMethod]
    public List<string> GetNames(string prefixText)
    {
        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["Connection"].ToString());
        con.Open();
        SqlCommand cmd = new SqlCommand("select * from familytwo where Name like @Name+'%'", con);
        cmd.Parameters.AddWithValue("@Name", prefixText);
        SqlDataAdapter da = new SqlDataAdapter(cmd);
        DataTable dt = new DataTable();
        da.Fill(dt);
        List<string> Names = new List<string>();
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            Names.Add(dt.Rows[i][1].ToString());
        }
        return Names;
    }


html代码:


html code:

<asp:TextBox ID="TextBox2"  runat="server" Width="244px">
                     <ajax:AutoCompleteExtender ID="AutoCompleteExtender"  runat="server" TargetControlID="TextBox2" ServiceMethod="GetNames"
                     ServicePath="~/autocompleteasmx.asmx" MinimumPrefixLength="1" EnableCaching="true" CompletionInterval="1000" CompletionSetCount="1">


那是什么问题..


whats the issue in that..
can anyone help me to solve this?

推荐答案

使用WCFTestClient,验证GetNames方法的功能是否返回值.
Using WCFTestClient, validate the functionality of GetNames method whether it returns the value or not.


在AutoCompleteExtender中缺少其他两个属性.它们是:

There are two other properties missing in AutoCompleteExtender. They are:

DelimiterCharacters=";, :"
ShowOnlyCurrentWordInCompletionListItem="true"


请一次查看此链接:

通过DataBase和AjaxControlToolkit自动完成 [
See this link once:

AutoComplete With DataBase and AjaxControlToolkit[^]


这篇关于自动完成扩展器不会在文本框中显示值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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