Ajax自动补全扩展器 [英] Ajax autocompletion Extender

查看:78
本文介绍了Ajax自动补全扩展器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在表单中使用Ajax自动完成扩展器.当用于自动完成的数组的值如{"9/3","3/22","3/22e"}}在表单弹出窗口中具有值3 ,0.1363636363,3/22e插入了"9/3","3/22","3/22e".用于自动完成的Web服务

I am using an Ajax auto completion extender in my form.When Array for auto completion has value like {"9/3","3/22","3/22e"} auto completion in form popup with values 3,0.1363636363,3/22e insted of "9/3","3/22","3/22e".Web service using for auto completion

[System.Web.Services.WebMethodAttribute(), System.Web.Script.Services.ScriptMethodAttribute()]
    public static string[] GetCompletionList(string prefixText, int count, string contextKey)
    {
        return (from m in ycode where m.StartsWith(prefixText, StringComparison.CurrentCultureIgnoreCase) select m).Take(count).ToArray();

    }


请给这个问题的解决方案


Plz suggest a solution for this problem

推荐答案

您需要将"prefixText"转换为适当的日期格式.那应该没问题. Herez代码将prefixText转换为

You need to convert ''prefixText'' into appropriate date format. Then it should be fine. Herez the code to convert prefixText into

DateTime.ParseExact(prefixText,
          "dd'/'MM'/'yyyy",
          CultureInfo.InvariantCulture).ToString();


以字符串形式读取此值只需在值前后添加双引号()
即字符串数组看起来像{"/" 9/3/","/" 3/22/","/" 3/22e/"}
并将我的Web服务更改为

To read this value as string Just add double quote (") before and after values
ie String array look like {"/"9/3/"","/"3/22/"","/"3/22e/""}
and change my Web service as

public static string[] GetCompletionList2(string prefixText, int count, string contextKey)
   {
       return (from m in fabcode where m.StartsWith("\""+prefixText, StringComparison.CurrentCultureIgnoreCase) select @m).Take(count).ToArray();
       
   }



现在,Java脚本以字符串形式读取"/" 3/22/""



Now java script read "/"3/22/"" as string


这篇关于Ajax自动补全扩展器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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