Why am I getting a textbox that returns undefined list of variables?
为什么我得到一个返回未定义变量列表的文本框?
When I run this code:
当我运行此代码时:
var query = (from tisa in db.TA_Info_Step_Archives
where tisa.ta_Serial.ToString().StartsWith(prefixText)
select tisa.TA_Serial.ToString()).Distinct().Take(Convert.ToInt32(count));
return query.ToList<string>().ToArray();
I get this XML file:
我得到这个XML文件:
<string>200700160</string>
<string>200700161</string>
<string>200700162</string>
<string>200700163</string>
<string>200700164</string>
<string>200700170</string>
<string>200700171</string>
<string>200700172</string>
<string>200700173</string>
<string>200700174</string>
<string>200700175</string>
<string>200700176</string>
<string>200700177</string>
<string>200700178</string>
<string>200700179</string>
<string>200700180</string>
<string>200700181</string>
<string>200700182</string>
<string>200700183</string>
<string>200700184</string>
BUT, the textbox returns a list of undefined
....
但是,文本框返回一个未定义的列表....
Help please?
7 个解决方案
#1
4
updated my ajax kit to version 1.0.10920 then changed my code to the following:
将我的ajax工具包更新到版本1.0.10920然后将我的代码更改为以下内容:
foreach (DataRow dr in dt.Rows)
{
items.SetValue("\"" + dr["somenumber"].ToString() + "\"", i);
i++;
}
Late friday nights with .net is not fun. I have no life. :-P
星期五晚上与.net并不好玩。我没有生命。 :-P
#2
1
I tried the code below and it worked for me:
我尝试了下面的代码,它对我有用:
items.SetValue("'"+dr["somenumber"]+"'", i);
#3
0
It sounds like the problem isn't with the method, but with the way you are hooking up the autocomplete to the method... Is your Extender similar to the following:
听起来问题不在于方法,而在于您将自动完成方法连接到方法的方式......您的Extender是否类似于以下内容:
<cc1:AutoCompleteExtender ID="Result" runat="server" TargetControlID="txtSearch" ServiceMethod="YourMethodHere"
ServicePath="~/Service/YourWebServiceHere.asmx" CompletionInterval="500"
EnableCaching="false" CompletionListCssClass="AutoComplete_List" CompletionSetCount="10">
</cc1:AutoCompleteExtender>
#4
0
The Problem that I am seeing is that the AJAX library is looking at the numbers as integers. It needs to be looking at them as strings.
我看到的问题是AJAX库将数字看作整数。它需要将它们视为字符串。
I have converted it to a string and still got nothing. I have to add some kind of character to the numbers to make their value now looked upon as a string. It is a horrible thing to do. But somewhere in the AJAX library for the autocomplete extender .js file, they don't look for integers. They only look for strings which needs to be looked at because their way of building is is flawed...
我已将它转换为字符串但仍然没有任何结果。我必须在数字中添加某种字符,以使它们的值现在被视为一个字符串。这是一件可怕的事情。但是在自动完成扩展器.js文件的AJAX库中的某个地方,它们并不寻找整数。他们只寻找需要看的字符串,因为他们的建筑方式是有缺陷的......
Scott.
#5
0
I've run into the same issue. I agree the issue definitely seems to be stemming around that we're using numbers here. As soon as I append an alpha to the end of a array item it works. I believe we've found a bug.
我遇到了同样的问题。我同意这个问题肯定似乎源于我们在这里使用数字。只要我将alpha附加到数组项的末尾就可以了。我相信我们发现了一个错误。
this kicks out the undefineds....
这踢出了未定义的....
...
da.Fill(dt);
string[] items = new string[dt.Rows.Count];
int i = 0;
foreach (DataRow dr in dt.Rows)
{
items.SetValue(Convert.ToString(dr["somenumber"]), i);
i++;
}
...
where as this loads the list just fine
在哪里加载列表就好了
...
da.Fill(dt);
string[] items = new string[dt.Rows.Count];
int i = 0;
foreach (DataRow dr in dt.Rows)
{
items.SetValue(Convert.ToString(dr["somenumber"]+"foo"), i);
i++;
}
...
Seems like a bug to me.
对我来说似乎是个错误。
#6
0
There is a difference between toolkit dll versions.
toolkit DLL版本之间存在差异。
In the updated version, one does not need to insert the "'"+ +"'", and it works fine. In version 1.0.10920, it is needed.
在更新版本中,不需要插入“'”+ +“'”,它可以正常工作。在版本1.0.10920中,它是必需的。
#7
0
http://www.asp.net/ajax In this above link u will find AjaxControllToolkit just download it and add reference in ur application i am sure it will work fine. problem is u r working with very old AjaxControllToolkit so its not working ,work with AjaxControllToolkit 3.5 or 4.0.
http://www.asp.net/ajax在上面这个链接你会发现AjaxControllToolkit只是下载它并在你的应用程序中添加引用我相信它会正常工作。问题是你使用非常古老的AjaxControllToolkit因此无法正常工作,使用AjaxControllToolkit 3.5或4.0。
#1
4
updated my ajax kit to version 1.0.10920 then changed my code to the following:
将我的ajax工具包更新到版本1.0.10920然后将我的代码更改为以下内容:
foreach (DataRow dr in dt.Rows)
{
items.SetValue("\"" + dr["somenumber"].ToString() + "\"", i);
i++;
}
Late friday nights with .net is not fun. I have no life. :-P
星期五晚上与.net并不好玩。我没有生命。 :-P
#2
1
I tried the code below and it worked for me:
我尝试了下面的代码,它对我有用:
items.SetValue("'"+dr["somenumber"]+"'", i);
#3
0
It sounds like the problem isn't with the method, but with the way you are hooking up the autocomplete to the method... Is your Extender similar to the following:
听起来问题不在于方法,而在于您将自动完成方法连接到方法的方式......您的Extender是否类似于以下内容:
<cc1:AutoCompleteExtender ID="Result" runat="server" TargetControlID="txtSearch" ServiceMethod="YourMethodHere"
ServicePath="~/Service/YourWebServiceHere.asmx" CompletionInterval="500"
EnableCaching="false" CompletionListCssClass="AutoComplete_List" CompletionSetCount="10">
</cc1:AutoCompleteExtender>
#4
0
The Problem that I am seeing is that the AJAX library is looking at the numbers as integers. It needs to be looking at them as strings.
我看到的问题是AJAX库将数字看作整数。它需要将它们视为字符串。
I have converted it to a string and still got nothing. I have to add some kind of character to the numbers to make their value now looked upon as a string. It is a horrible thing to do. But somewhere in the AJAX library for the autocomplete extender .js file, they don't look for integers. They only look for strings which needs to be looked at because their way of building is is flawed...
我已将它转换为字符串但仍然没有任何结果。我必须在数字中添加某种字符,以使它们的值现在被视为一个字符串。这是一件可怕的事情。但是在自动完成扩展器.js文件的AJAX库中的某个地方,它们并不寻找整数。他们只寻找需要看的字符串,因为他们的建筑方式是有缺陷的......
Scott.
#5
0
I've run into the same issue. I agree the issue definitely seems to be stemming around that we're using numbers here. As soon as I append an alpha to the end of a array item it works. I believe we've found a bug.
我遇到了同样的问题。我同意这个问题肯定似乎源于我们在这里使用数字。只要我将alpha附加到数组项的末尾就可以了。我相信我们发现了一个错误。
this kicks out the undefineds....
这踢出了未定义的....
...
da.Fill(dt);
string[] items = new string[dt.Rows.Count];
int i = 0;
foreach (DataRow dr in dt.Rows)
{
items.SetValue(Convert.ToString(dr["somenumber"]), i);
i++;
}
...
where as this loads the list just fine
在哪里加载列表就好了
...
da.Fill(dt);
string[] items = new string[dt.Rows.Count];
int i = 0;
foreach (DataRow dr in dt.Rows)
{
items.SetValue(Convert.ToString(dr["somenumber"]+"foo"), i);
i++;
}
...
Seems like a bug to me.
对我来说似乎是个错误。
#6
0
There is a difference between toolkit dll versions.
toolkit DLL版本之间存在差异。
In the updated version, one does not need to insert the "'"+ +"'", and it works fine. In version 1.0.10920, it is needed.
在更新版本中,不需要插入“'”+ +“'”,它可以正常工作。在版本1.0.10920中,它是必需的。
#7
0
http://www.asp.net/ajax In this above link u will find AjaxControllToolkit just download it and add reference in ur application i am sure it will work fine. problem is u r working with very old AjaxControllToolkit so its not working ,work with AjaxControllToolkit 3.5 or 4.0.
http://www.asp.net/ajax在上面这个链接你会发现AjaxControllToolkit只是下载它并在你的应用程序中添加引用我相信它会正常工作。问题是你使用非常古老的AjaxControllToolkit因此无法正常工作,使用AjaxControllToolkit 3.5或4.0。