Autocomplete dropping leading zeros and trailing zeros after a hyphen

Autocomplete Web Service Code

1    Imports System.Web
2    Imports System.Web.Services
3    Imports System.Web.Services.Protocols
4    Imports System.Data.SqlClient
5    Imports System.Data
6   
7    ' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
8    <System.Web.Script.Services.ScriptService()> _
9    <WebService(Namespace:="http://tempuri.org/")> _
10   <WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
11   <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
12   Public Class AutoComplete
13       Inherits System.Web.Services.WebService
14  
15       <WebMethod()> _
16       Public Function GetOrderNumber(ByVal prefixText As String, ByVal count As Integer) As String()
17        
18           Dim emp As New List(Of String)
19  
20           Dim conn As String = "Data Source=GLPT-SQL\CSI_SQL;Initial Catalog=CSITSS;Persist Security Info=True;User ID=*******;Password=*********"
21  
22           Dim query As String = "SELECT O.[OrderNumber] FROM [CSITSS].[dbo].[Orders] as O WHERE O.CompanyDiv = 'GLPC-TRANS' and O.Deleted = 0 and O.Terminal = 'COD' and (OrderNumber LIKE '%" & prefixText & "%')"
23  
24           Dim da As New SqlDataAdapter(query, conn)
25  
26           Dim ds As New DataSet
27           da.Fill(ds)
28  
29           If ds.Tables(0).Rows.Count < count Then
30               count = ds.Tables(0).Rows.Count
31           End If
32           Dim items As New List(Of String)
33           For i As Integer = 1 To count
34  
35               items.Add(ds.Tables(0).Rows(i - 1).Item(0).ToString)
36  
37           Next i
38  
39           Return items.ToArray()
40  
41       End Function
42       <WebMethod()> _
43       Public Function GetPropertyID(ByVal prefixText As String, ByVal count As Integer) As String()
44  
45           Dim emp As New List(Of String)
46  
47           Dim conn As String = "
Data Source=GLPT-SQL\CSI_SQL;Initial Catalog=CSITSS;Persist Security Info=True;User ID=*******;Password=*********"
48  
49           Dim query As String = "
SELECT [CustomerID] FROM [CSITSS].[dbo].[Customer] WHERE CustomerID < '9999999999' and CompanyDiv = 'GLPC-TRANS' and (CustomerID LIKE '%" & prefixText & "%')"
50  
51           Dim da As New SqlDataAdapter(query, conn)
52  
53           Dim ds As New DataSet
54           da.Fill(ds)
55  
56           If ds.Tables(0).Rows.Count < count Then
57               count = ds.Tables(0).Rows.Count
58           End If
59           Dim
items As New List(Of String)
60           For i As Integer = 1 To count
61  
62               items.Add(ds.Tables(0).Rows(i - 1).Item(0).ToString)
63  
64           Next i
65  
66           Return items.ToArray()
67  
68       End Function
69  
70   End Class

 This web service works but the output below isn't what shows up on the autocomplete menu. 

GetOrderNumber Results

1       
2    - <ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/">
3      <string>00064979-0</string> 
4      </ArrayOfString>
 
GetPropertyID Results
1     
2    - <ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/">
3      <string>0009620000</string>
4      <string>0459620000</string>
5      </ArrayOfString>
 
GetOrderNumber Results on Textbox
 
64979
 
GetPropertyId Results on Textbox
9620000
459620000
 
How do I make it display the entire string result???

Need a new credit Card?
Get a free system for generating up to 12 new streams of income and 22 videos on web promotion.
0
tdecker81
4/30/2008 6:54:40 PM
asp.net.ajax_control_toolkit 17816 articles. 1 followers. Follow

1 Replies
1087 Views

Similar Articles

[PageSpeed] 36
Get it on Google Play
Get it on Apple App Store

Reply:

Similar Artilces:

Autocomplete dropping leading zeros from results string array
Hi all, I am using the autocomplete control to retrieve values from a DB. When i do a search on a string beginning with a 0 the 0 is dropped from the results shown on screen. I have debugged the GetCompletionList method and the returning string array definetly has the leading zero's. As far as i can tell it only happens with the 0 character.   Any one have any ideas? Cheers,P.S. I am using .net 2.0 with ajax extensions 1.0   Hi WhatStherush, It is a known issue, please add the return items like this, myList.Add("\""+dr.GetString(0)+"\"&quo...

Excel has dropped leading zeros
Hello all, I have a problem with code that exports data from SQL Server to Excel and removes leading zeros from the data in the spreadsheet. My code is below.  Is there a formatting option or something that I need to add to maintain these leading zeros?  I know that you need to treat the data as text but how is that done programmatically? DataSet objDs = new DataSet();             string source = UtilityClass.decode(ConfigurationManager.AppSettings["DSN"]);          ...

What's the difference between zero, positive zero, and negative zero?
I'm running PB version 7.0.3 Build 10047 on a windows 2000 PC. For a data window I have a sql statement that selects three columns, I'll call them A, B, and C. In the data window I compute a fourth column, I'll call it D, as ((A - B) - C). For over 90% of the rows everything looks good, the rows where D should be zero come out as zero. But on the others, sometimes D is positive zero and sometimes negative zero. This is consistant for a row; is I rerun the data window the same rows keep turning up as positive or negative zero. And positive zero is greater than zero. I...

Dropping leading zeros in a GridView nvarchar field
I have a GridView that displays a column where the data is an "nvarchar" type.  These values are numbers, but look like this: "001", "002", "009", "010", "011". I would like to trim off the leading zeroes in the displayed GridView.  I have experimented with using a DataFormatString, but that is not working, as the values are not numbers - they are strings, essentially.  I know I could modify my database to store integers (as all of these values are in fact, numbers), but that brings up another problem.  I have &...

Leading zeros?
I need help with leading zeros within the presentation layer of asp.net. I'm pulling a number from a sql database and display it on a textbox. I want that number to have leading zeros. Example: 149 I want that to be like 00149 or 1234 to be like 01234. I tried several examples provided within some of the previous threads but no luck. Example I use this one: varNum = String.Format("{0:00000}", varStr) Please advise. try something like this : Dim i As Integer, j As String, k As String, val as string i = 123 k = "00000" j = Convert.T...

Leading zeros
How can you place leading zeros on an integer before converting to string? You can't add leading 0's to the integer but why not do..... MyString = "00000" & str(MyInt) Mat Please try the following varStr = string.Format("{0:000000000}",varNum); ThanksSenthil Nathan http://www.chendhur.com Hi Try as below : Dim PadNbr As String = Trim(Str(12345)) Response.Write(PadNbr.PadLeft(Len(PadNbr) + 1, "0")) HTH K B ShajudeenAreYaar.comDubai, United Arab Emirates....

Leading Zero
Does anyone know of a existing problem from inetcfg bind then reinitialize system then the udp/tcp is putting in a leading zero at the third octect ....192.168.0.21 - 192.168.00.21...This is causing a problem of course....Help Gerald Cummings wrote: > Does anyone know of a existing problem from inetcfg bind then reinitialize > system then the udp/tcp is putting in a leading zero at the third octect > ...192.168.0.21 - 192.168.00.21...This is causing a problem of > course....Help Haven't seen that one... what version of netware, service packs, tcp/ip etc? Is...

Leading zero ?!
Hi,I'm using Convert.ToString() method to convert Hour or Minute of a datetime format control to a string but it's not a leading zero string.  How can I do it ?Please help !cheers,stephen   I think you are using the wrong ToString try DateTime.ToString and System.TimeSpan.  Hope this helps.http://msdn2.microsoft.com/en-us/library/system.timespan.aspxhttp://msdn2.microsoft.com/en-us/library/k494fzbf.aspxKind regards,Gift Peddie  By using the DateTime's ToString and with a format expression, you can format the date into a string...

Trailing Zeros
Hi How do i take care of trailing zeros in datawindows.ie if i have a column of type decimal(4) in a datawindow then the trailing zeros after the decimal are automatically inserted in the datawindow . How do i take care of that??? Thanks in advance Gaurav Make your field as an editmask, put "###,###.0000" in Mask propertie and put followed expression "if ( isnull(your_field), ' ', if ( your_field - truncate(your_field,0) = 0,'###,###' ,'###,###.####') )" in Format propertie and check 'use format' to use Format expression when ...

autocomplete returning items with leading zero's cut off.
Hi, I have a list of items in my DB with this naming convention. 0001 0002 0003 etc. In a webservice, I add them to a generic string list, and return the list ToArray.  I debugged through and it shows the values being returned correctly.  However on the on AJAX AutoComplete extender, the values in the drop down are listed with all the leading zero's cut off.  For example just 1, 2, 3.  Any thoughts on what might be causing this? Thank you. I have came accross this problem before, I have a post on how to solve it in my blog, take a look: http://www.gbogea.com...

Trailing Zero
Hi, i have a textbox which displays the numeric value from database.. i have the value as 07089,but my textbox displays 7089.it doesnot displays the trailing zero.. can anyone give solution for diz... Thanks in advance..  viji   TextBox1.Text = "7089".PadLeft(5, '0');Thanks, EdMicrosoft MVP - ASP/ASP.NET works fine,Thank you....

Leading zeroes
Hello, How can I suppress the leading zeroes, except one when all positions are 0; for example: 000015 will be 15 000000 will be 0 thank you. Olivier -- +++ GMX - die erste Adresse f�r Mail, Message, More +++ Neu: Preissenkung f�r MMS und FreeMMS! http://www.gmx.net Olivier Wirz wrote: > Hello, > > How can I suppress the leading zeroes, except one when all positions are 0; > for example: > > 000015 will be 15 > 000000 will be 0 This is a pretty vague question. How are you outputting the numbers? Are you writing to a file, using print...

GridView & FormView dropping leading zeros from numbers set as strings
I'm storing in a SQL database a certain field (an employee number) as a varchar data type. Throughout the app (datasource, update/insert stored procedures, etc.) I'm working with it as a string. I've even ensured that it's being used as a string "behind the scenes" by watching it in SQL Profiler. Problem is, the GridView & FormView that display it always drop any leading zeros. Wierder yet, when I put the GridView in Edit mode & add a zero, it saves to the database with the zero, but the leading zero doesn't display in the GridView! Anyone kn...

Zero-width split() match creates empty trailing strings but not empty leading strings
The perlfunc documentation spells this out clearly, and it matches what I see: $ perl -e 'for (split(//, "fob", -1)) { print "$_\n"; }' | sed -e 's/^$/<blank>/' f o b <blank> The question on my mind is why. In particular, is it a decision worth replicating to language's libraries? Thanks for any pointers. I tried to find the source for split, and I think I may have found it in pp_split in pp.c. But there's not really any reason to expect the source code to include the justification, and I couldn't find one. http:/...

Web resources about - Autocomplete dropping leading zeros and trailing zeros after a hyphen - asp.net.ajax_control_toolkit

Autocomplete - Wikipedia, the free encyclopedia
Autocomplete , or word completion , is a feature provided by many web browsers , e-mail programs , search engine interfaces, source code editors ...

Autocomplete Me - EPIC FAIL Funny Videos and Epic Fail Funny Pictures
Click for more epic fails, videos, and wins. (Share this post and make someone ROFL!)

Autocomplete Data - Facebook-Entwickler
The value specified for the type parameter is the category of autocomplete data to retrieve, e.g. to retrieve locales, you can specify type=adlocale ...

OneKeyboard - colorful and fast custom autocomplete keyboard on the App Store on iTunes
Get OneKeyboard - colorful and fast custom autocomplete keyboard on the App Store. See screenshots and ratings, and read customer reviews.

Distraction of the Day: Someone Turned Google Autocomplete Into a Family Feud-Style Game
Say goodbye to productivity, because this game just took over your workday/life. Whenever you start typing a search into Google, the search engine ...

Selling kidneys to buy drones: the economy according to Google autocomplete
Autocomplete, the Google function that suggests full search questions based on a few words, has long served as a humorous (or harrowing) window ...

‘Google Feud’ combines popular game show with Google search autocomplete
Surely by now you've seen various jokes about Google's autocomplete feature, which suggests endings for your search terms based on what other ...

TweetDeck for Mac updated with username autocomplete, a new tweet composer, and more
... App Store . Check out 9to5Mac for more breaking coverage of Apps . What do you think? Discuss "TweetDeck for Mac updated with username autocomplete, ...

New Twitter Search Comes with Autocomplete and New Filters
Last Friday, Twitter announced what’s new on its search functionality: Search autocomplete and “People You Follow” search result. In addition ...

Google Autocomplete Is Letting The Terrorists Win
Be careful about what you search for on Google...

Resources last updated: 12/3/2015 11:30:24 PM