Why is my ASP.NET AutoCompleteExtender returning undefined?

Why do I get a text box that returns an 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:

<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 text box returns a list undefined....

Help me please?

+3
source share
7 answers

updated my ajax kit to version 1.0.10920, then changed the code to the following:

     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

+4
source

I tried the code below and it worked for me:

items.SetValue("'"+dr["somenumber"]+"'", i);
+1
source

, , , ... 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>
0

, , , AJAX . .

. - , . . - AJAX .js . , , ...

.

0

. , , . , . , .

....

...
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++;
        }
...

,

...
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++;
        }
...

, .

0

dll toolkit.

In the updated version, you do not need to insert "+" and "+", and it works fine. In version 1.0.10920, this is necessary.

0
source

http://www.asp.net/ajax In this link you will find AjaxControllToolkit, just download it and add the link to the ur application, I am sure that it will work fine. the problem is working with the very old AjaxControllToolkit, so it does not work, it works with AjaxControllToolkit 3.5 or 4.0.

0
source

Source: https://habr.com/ru/post/1698112/


All Articles