搜索

ajax技术---asp.net ajax autocomplete undefined with numbers

[复制链接]

该用户从未签到

分享到:
发表于 2009-7-30 16:47 | 显示全部楼层 |阅读模式
本帖最后由 ssqj111 于 2012-6-18 13:06 编辑

Description
Description is required
I was having a problem with my autocomplete extender filling with "undefined" when numbers rather than letters were involved in the db query return. My web service was retrieving and returning everything just fine but the autocomplete could not handle the numbers even though I tried converting to strings before adding to the array.

THE FIX: instead of converting just wrap the number in single quotes

i.e.
Dim drPart As DataRow
For Each drPart In dsParts.Tables(0).Rows
'the two quotes are added because autocomplete is retarded when handling numbers
lItems.Add("'" & drPart("sItemID") & "'")
Next

Return lItems.ToArray()

This will in turn be automatically stripped out by the control and voila you have the numbers showing up just fine




免责声明:用户在本平台发表的内容(如有图片或视频亦包括在内)仅表明其个人观点,不代表本平台观点,本平台亦不承担任何法律及连带责任,本平台仅提供信息存储服务;本平台发布的信息仅为传递、参考之用,不构成任何投资、使用等行为的建议。任何后果均由用户自行承担;转载文章的版权归原作者所有,如有侵权,请与我们取得联系,我们将立即整改或删除相关内容。

使用高级回帖 (可批量传图、插入视频等)快速回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则   Ctrl + Enter 快速发布  

发帖时请遵守我国法律,网站会将有关你发帖内容、时间以及发帖IP地址等记录保留,只要接到合法请求,即会将信息提供给有关政府机构。
快速回复 返回顶部 返回列表