473,387 Members | 1,464 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Passing data in strings

Hi,

I come from 9 years of C/C++ programming and I'm working with a team
of very experienced ASP developers. There are some practices they
follow which I don't agree with, and I'd like to know if there's a
better way of doing this:

1) To populate a dropdown control that's on a page with data coming
from the database, the developers concatenate all the values separated
by a pipe character and pass the string to the JS function, which
splits the string and adds the values to the dropdown control.

I think this is not a best practice b/c:

A) If the data returned from the database results in a string that's
too long, it could exceed the limit of the JS string type and some
items would be missing from the dropdown.

B) If by any chance, the data from the database contain pipe
character, it would result in extra elements inserted in the dropdown
control.

Is there a better way to pass data to JS w/o relying in strings? How
can these practices be improved?

Thank you in advance,

Rick

Jul 27 '07 #1
1 1143
Rick wrote:
Is there a better way to pass data to JS w/o relying in strings? How
can these practices be improved?
Use JSON respectively an array literal
["item 1", "item 2", "item 3"]
see <http://www.json.org/>.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 27 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Jack | last post by:
Hi, I need to pass multple variables in a link in order to go to a asp page with the two varables. The following are the values of the variables using response.write: <%'Response.Write Mypage...
1
by: Newbie | last post by:
Is there a way to pass strings from one webform to another without using Response.Redirect( ) ? The reason is that I need the webform passing the string to close its window.
3
by: Mark | last post by:
Hi From what I understand, you can pass arrays from classic ASP to .NET using interop, but you have to change the type of the.NET parameter to object. This seems to be because classic ASP passes...
0
by: Dave Cullen | last post by:
I have a dll written in VC6 that I need to send arguments to from a call in VB.NET. I'm having trouble passing data arguments between them. So far I've only tried passing strings, and all I get...
22
by: Arne | last post by:
How do I pass a dataset to a webservices? I need to submit a shoppingcart from a pocket PC to a webservice. What is the right datatype? II have tried dataset as a datatype, but I can't get it to...
11
by: Macca | last post by:
Hi, I'm writing an application that will pass a large amount of data between classes/functions. In C++ it was more efficient to send a pointer to the object, e.g structure rather than passing...
61
by: academic | last post by:
When I declare a reference variable I initialize it to Nothing. Now I'm wondering if that best for String variables - is "" better? With Nothing I assume no memory is set aside nor GC'ed But...
7
by: Smokey Grindle | last post by:
For a website that has users logged into it using sessions, its it best to pass data between pages in session variables or through query strings?
1
by: fyreblaize | last post by:
I'm having trouble passing an array of strings to a function. all i'm doing is loading in 5 names, then printing them out. compiles fine, but when i run, i get an error (im guessing its associated...
11
by: =?Utf-8?B?U3VqZWV0?= | last post by:
If there are long strings (like 1MB or 2MB) is it more performant to pass those by ref to methods or by value?
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.