Click here to Skip to main content
15,903,854 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using an Ajax auto completion extender in my form.When Array for auto completion has value like {"9/3","3/22","3/22e"} auto completion in form popup with values 3,0.1363636363,3/22e insted of "9/3","3/22","3/22e".Web service using for auto completion
C#
[System.Web.Services.WebMethodAttribute(), System.Web.Script.Services.ScriptMethodAttribute()]
    public static string[] GetCompletionList(string prefixText, int count, string contextKey)
    {
        return (from m in ycode where m.StartsWith(prefixText, StringComparison.CurrentCultureIgnoreCase) select m).Take(count).ToArray();

    }

Plz suggest a solution for this problem
Posted

You need to convert 'prefixText' into appropriate date format. Then it should be fine. Herez the code to convert prefixText into

C#
DateTime.ParseExact(prefixText,
          "dd'/'MM'/'yyyy",
          CultureInfo.InvariantCulture).ToString();
 
Share this answer
 
Comments
rajin kp 18-May-12 5:22am    
Thaks for your replay,
Actually My problem is not related to date. data displayed in auto completion {"9/3","3/22","3/22e"} are foreign key in the form.
To read this value as string Just add double quote (") before and after values
ie String array look like {"/"9/3/"","/"3/22/"","/"3/22e/""}
and change my Web service as

C#
public static string[] GetCompletionList2(string prefixText, int count, string contextKey)
   {
       return (from m in fabcode where m.StartsWith("\""+prefixText, StringComparison.CurrentCultureIgnoreCase) select @m).Take(count).ToArray();
       
   }


Now java script read "/"3/22/"" as string
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900