zoukankan      html  css  js  c++  java
  • AutoCompleteExtender控件出现undefined和null现象

    近日研究ajax control toolkit 在使用AutoCompleteExtender自动输入完成控件时发现一个问题,也许这是微软的一个bug吧。如果返回的数组是纯数字,那么将变成undefined(非0情况)或null(0为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定义有关系吧!

  • 相关阅读:
    莫比乌斯反演学习笔记
    NOIp 2020 游记
    题解【LOJ3087】「GXOI / GZOI2019」旅行者
    题解【CF999E】Reachability from the Capital
    题解【LOJ2007】「SCOI2015」国旗计划
    题解【LOJ3145】「APIO2019」桥梁
    题解【LOJ2114】「HNOI2015」菜肴制作
    CSP-J/S 2020 爆炸记
    题解【洛谷P2569】[SCOI2010]股票交易
    补题目录
  • 原文地址:https://www.cnblogs.com/ami/p/904202.html
Copyright © 2011-2022 走看看