AutoCompleteExtender控件出现undefined和null现象

翻译|其它|编辑:郝浩|2007-09-27 10:39:34.000|阅读 1203 次

概述:

# 界面/图表报表/文档/IDE等千款热门软控件火热销售中 >>

近日研究  ajax control toolkit  在使用  AutoCompleteExtender  自动输入完成控件时发现一个问题,也许这是微软的一个  bug  吧。如果返回的数组是纯数字,那么将变成  undefined(非0情况)或  null0  null)。

 

[System.Web.Services.WebMethodAttribute(), System.Web.Script.Services.ScriptMethodAttribute()]
    public static string[] GetCompletionList(string prefixText, int count, string contextKey)
    {       
         string[] s = new string[3];

        for (int i = 0; i < 3; i++)
        {
            s[i] = i.ToString();
        }

         return s;   
    }


在上面情况下,将返回:null,undefined,undefined,如果我们改成

 

[System.Web.Services.WebMethodAttribute(), System.Web.Script.Services.ScriptMethodAttribute()]
    public static string[] GetCompletionList(string prefixText, int count, string contextKey)
    {       
         string[] s = new string[3];        
        s[0] = "
中文";
        s[1] = "abc";
        s[2] = "123abc";        
         return s;   
    }


那么将返回真确的值。
我还不清楚为什么数字字符串会变成  undefined    null,也许是和  javascript  定义有关系吧!

 


标签:

本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@evget.com

文章转载自:博客园

为你推荐

  • 推荐视频
  • 推荐活动
  • 推荐产品
  • 推荐文章
  • 慧都慧问
扫码咨询


添加微信 立即咨询

电话咨询

客服热线
023-68661681

TOP