473,396 Members | 1,996 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,396 software developers and data experts.

Create String

Hello,

I need to create the following string at runtime to add to my page:

"
<script type="text/javascript"><!--
client = "3894758346587";
width = 800;
height = 600;
format = "image";
FirstWord; SecondWord
name = "1213131+6456456";
//-->
</script>
"

The values client, width, height, format, FirstWord, SecondWord, name
are taken from properties with the same name: Me.Client, Me.Width, ...

What is the best way to build this string.

Note that if, for example, Me.Client is empty then the code line
'client="3894758346587";' should not be added.

Thanks,
Thanks

Oct 19 '07 #1
2 1173
shapper wrote:
Hello,

I need to create the following string at runtime to add to my page:

"
<script type="text/javascript"><!--
client = "3894758346587";
width = 800;
height = 600;
format = "image";
FirstWord; SecondWord
name = "1213131+6456456";
//-->
</script>
"

The values client, width, height, format, FirstWord, SecondWord, name
are taken from properties with the same name: Me.Client, Me.Width, ...

What is the best way to build this string.

Note that if, for example, Me.Client is empty then the code line
'client="3894758346587";' should not be added.

Thanks,
Thanks
Use a StringBuilder to create the string, then the
ClientScript.RegisterStartupScript method to add it to the page.

You can make the RegisterStartupScript method add the script tag, so
don't put that in the string, just the Javascript code.

--
Göran Andersson
_____
http://www.guffa.com
Oct 19 '07 #2
you could get more object oriented and use a JSON serializer.

-- bruce

shapper wrote:
Hello,

I need to create the following string at runtime to add to my page:

"
<script type="text/javascript"><!--
client = "3894758346587";
width = 800;
height = 600;
format = "image";
FirstWord; SecondWord
name = "1213131+6456456";
//-->
</script>
"

The values client, width, height, format, FirstWord, SecondWord, name
are taken from properties with the same name: Me.Client, Me.Width, ...

What is the best way to build this string.

Note that if, for example, Me.Client is empty then the code line
'client="3894758346587";' should not be added.

Thanks,
Thanks
Oct 19 '07 #3

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

Similar topics

7
by: dog | last post by:
I've seen plenty of articles on this topic but none of them have been able to solve my problem. I am working with an Access 97 database on an NT4.0 machine, which has many Access reports. I...
2
by: James Moore | last post by:
I've got a datagrid. One of the elements in the grid is a comma-seperated string. I'd like to split the string and create N linkbuttons, one for each element of the string. Creating the grid...
7
by: Dave Taylor | last post by:
I have a DataTable with three string columns, "Value", "Format" and "Type" However, some of the rows contain numbers and dates in the Value field. So I would like to be able to format the output...
1
by: Federico | last post by:
Hi I want to create a Web Services where I receive a Template DOT word a file XML and with these I create a Document that a I'll Send as Dime Attachment. <WebMethod()> _ Public Function...
5
by: Michael Sperlle | last post by:
Is it possible? Bestcrypt can supposedly be set up on linux, but it seems to need changes to the kernel before it can be installed, and I have no intention of going through whatever hell that would...
23
by: sandy | last post by:
I need (okay, I want) to make a dynamic array of my class 'Directory', within my class Directory (Can you already smell disaster?) Each Directory can have subdirectories so I thought to put these...
27
by: max | last post by:
Hello, I am a newbye, and I'm trying to write a simple application. I have five tables with three columns; all tables are identical; I need to change some data in the first table and let VB...
4
by: etuncer | last post by:
Hello All, I have Access 2003, and am trying to build a database for my small company. I want to be able to create a word document based on the data entered through a form. the real question is...
4
Ispep
by: Ispep | last post by:
Hi, unfortunately having a bit of difficulty with a question from an Open University course I'm currently doing. If you could help me out in any way I'd be grafeul (though obviously it goes without...
4
by: Vlad | last post by:
I am having problems using the file.create method within a function that is called when looping through an array of filepaths. If I call my function with a hardcoded file path --C:\Temp.txt the...
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: 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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.