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定义有关系吧!

  • 相关阅读:
    Python之爬虫(十四) Scrapy框架的架构和原理
    Python之爬虫从入门到放弃(十三) Scrapy框架整体的了解
    Python之 爬虫(十二)关于深度优先和广度优先
    kali linux
    html5笔记
    python 3.4.3 安装pygame
    跳格子
    简单字符串查找
    KMP算法查找字符串
    ios系统保存校园网密码
  • 原文地址:https://www.cnblogs.com/ami/p/904202.html
Copyright © 2011-2022 走看看