blowfish 发表于 2009-7-30 16:47

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

本帖最后由 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




页: [1]
查看完整版本: ajax技术---asp.net ajax autocomplete undefined with numbers