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

Build script dynamically...

Hi!

Here is my problem: I'm inserting script for Trust Logo from one of the SSL
authorities.
It works fine when I do it in HTML, but I need to build it dynamically:

HtmlTableRow tR = new HtmlTableRow();
HtmlTableCell tC1 = new HtmlTableCell();
tC1.Controls.Add(new LiteralControl("<script
type=\"text/javascript\">TrustLogo(\"https://" +
ConfigurationSettings.AppSettings["DomainName"] +
"/images/secure_site.gif\", \"SC\", \"none\");</script>"));
tR.Cells.Add(tC1);
This doesn't work, gives me error:
CS1010: Newline in constant

How do I do it?
Nov 17 '05 #1
6 3362
The problem is when you are building your javascript... Try this...

HtmlTableRow tR = new HtmlTableRow();
HtmlTableCell tC1 = new HtmlTableCell();

// Type the statement as a single line vs multiple... Or you can build a
string var for visibility sake... See below.
tC1.Controls.Add(new LiteralControl("<script
type=\"text/javascript\">TrustLogo(\"https://" +
ConfigurationSettings.AppSettings["DomanName"] + "/images/secure_site.gif\",
\"SC\", \"none\");</script>"));

tR.Cells.Add(tC1);

// For readability...
String jscript;

Jscript = "<script type=\"text/javascript\">";
Jscript += "TrustLogo(\"https://";
Jscript += ConfigurationSettings.AppSettings["DomanName"];
Jscript += "/images/secure_site.gif\", \"SC\", \"none\");"; Jscript +=
"</script>"

tC1.Controls.Add(new LiteralControl(Jscript));

Hope this helps.

"Ivan Demkovitch" <i@a.b> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi!

Here is my problem: I'm inserting script for Trust Logo from one of the SSL authorities.
It works fine when I do it in HTML, but I need to build it dynamically:

HtmlTableRow tR = new HtmlTableRow();
HtmlTableCell tC1 = new HtmlTableCell();
tC1.Controls.Add(new LiteralControl("<script
type=\"text/javascript\">TrustLogo(\"https://" +
ConfigurationSettings.AppSettings["DomainName"] +
"/images/secure_site.gif\", \"SC\", \"none\");</script>"));
tR.Cells.Add(tC1);
This doesn't work, gives me error:
CS1010: Newline in constant

How do I do it?

Nov 17 '05 #2
The problem is when you are building your javascript... Try this...

HtmlTableRow tR = new HtmlTableRow();
HtmlTableCell tC1 = new HtmlTableCell();

// Type the statement as a single line vs multiple... Or you can build a
string var for visibility sake... See below.
tC1.Controls.Add(new LiteralControl("<script
type=\"text/javascript\">TrustLogo(\"https://" +
ConfigurationSettings.AppSettings["DomanName"] + "/images/secure_site.gif\",
\"SC\", \"none\");</script>"));

tR.Cells.Add(tC1);

// For readability...
String jscript;

Jscript = "<script type=\"text/javascript\">";
Jscript += "TrustLogo(\"https://";
Jscript += ConfigurationSettings.AppSettings["DomanName"];
Jscript += "/images/secure_site.gif\", \"SC\", \"none\");"; Jscript +=
"</script>"

tC1.Controls.Add(new LiteralControl(Jscript));

Hope this helps.

"Ivan Demkovitch" <i@a.b> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi!

Here is my problem: I'm inserting script for Trust Logo from one of the SSL authorities.
It works fine when I do it in HTML, but I need to build it dynamically:

HtmlTableRow tR = new HtmlTableRow();
HtmlTableCell tC1 = new HtmlTableCell();
tC1.Controls.Add(new LiteralControl("<script
type=\"text/javascript\">TrustLogo(\"https://" +
ConfigurationSettings.AppSettings["DomainName"] +
"/images/secure_site.gif\", \"SC\", \"none\");</script>"));
tR.Cells.Add(tC1);
This doesn't work, gives me error:
CS1010: Newline in constant

How do I do it?

Nov 17 '05 #3
Hmm...

What is the difference between what I had and yours ?

Thanks!

"Ivan Demkovitch" <i@a.b> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi!

Here is my problem: I'm inserting script for Trust Logo from one of the SSL authorities.
It works fine when I do it in HTML, but I need to build it dynamically:

HtmlTableRow tR = new HtmlTableRow();
HtmlTableCell tC1 = new HtmlTableCell();
tC1.Controls.Add(new LiteralControl("<script
type=\"text/javascript\">TrustLogo(\"https://" +
ConfigurationSettings.AppSettings["DomainName"] +
"/images/secure_site.gif\", \"SC\", \"none\");</script>"));
tR.Cells.Add(tC1);
This doesn't work, gives me error:
CS1010: Newline in constant

How do I do it?

Nov 17 '05 #4
Hmm...

What is the difference between what I had and yours ?

Thanks!

"Ivan Demkovitch" <i@a.b> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi!

Here is my problem: I'm inserting script for Trust Logo from one of the SSL authorities.
It works fine when I do it in HTML, but I need to build it dynamically:

HtmlTableRow tR = new HtmlTableRow();
HtmlTableCell tC1 = new HtmlTableCell();
tC1.Controls.Add(new LiteralControl("<script
type=\"text/javascript\">TrustLogo(\"https://" +
ConfigurationSettings.AppSettings["DomainName"] +
"/images/secure_site.gif\", \"SC\", \"none\");</script>"));
tR.Cells.Add(tC1);
This doesn't work, gives me error:
CS1010: Newline in constant

How do I do it?

Nov 17 '05 #5
Well I know that sometimes when I try to build a string and seperate the
lines (pressing enter key mid string), the enter key places a \n (newline)
character in the string. I just looked at my last reply and I do see it
serperated.... It supposed to be a single line of code vs multi for building
the "literal" string. I agree with you, logically placing the '+' between
breaks should do the trick but it dont sometimes...

Also, I remember one time where I copied and pasted a string from a word
doc, placed the string all on one line... and still get the error. That was
because the \n charcter was still in the string... You just could not see
it.

For example:
I copied the leteral string from the last reply I sent...

"<script
type=\"text/javascript\">TrustLogo(\"https://" +
ConfigurationSettings.AppSettings["DomanName"] + "/images/secure_site.gif\",
\"SC\", \"none\");</script>"

Pasted it into my code and get the error "Newline in constant"... then I
cleaned it up and it was fine. Unfortunatly, there is no good way of
finding the "newline".

"Ivan Demkovitch" <i@a.b> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi!

Here is my problem: I'm inserting script for Trust Logo from one of the SSL authorities.
It works fine when I do it in HTML, but I need to build it dynamically:

HtmlTableRow tR = new HtmlTableRow();
HtmlTableCell tC1 = new HtmlTableCell();
tC1.Controls.Add(new LiteralControl("<script
type=\"text/javascript\">TrustLogo(\"https://" +
ConfigurationSettings.AppSettings["DomainName"] +
"/images/secure_site.gif\", \"SC\", \"none\");</script>"));
tR.Cells.Add(tC1);
This doesn't work, gives me error:
CS1010: Newline in constant

How do I do it?

Nov 17 '05 #6
Well..
Wasn't able to make it work ...

I steel use hardcoded script.

Also, I do not use VS, I use WebMatrix and this is almost just plain text
editor.
Looked over and over without any luck.

Is there any way to do <%# %> in script to insert my data?
"Alex Davis" <al*******@bellsouth.net> wrote in message
news:uE**************@tk2msftngp13.phx.gbl...
Well I know that sometimes when I try to build a string and seperate the
lines (pressing enter key mid string), the enter key places a \n (newline)
character in the string. I just looked at my last reply and I do see it
serperated.... It supposed to be a single line of code vs multi for building the "literal" string. I agree with you, logically placing the '+' between
breaks should do the trick but it dont sometimes...

Also, I remember one time where I copied and pasted a string from a word
doc, placed the string all on one line... and still get the error. That was because the \n charcter was still in the string... You just could not see
it.

For example:
I copied the leteral string from the last reply I sent...

"<script
type=\"text/javascript\">TrustLogo(\"https://" +
ConfigurationSettings.AppSettings["DomanName"] + "/images/secure_site.gif\", \"SC\", \"none\");</script>"

Pasted it into my code and get the error "Newline in constant"... then I
cleaned it up and it was fine. Unfortunatly, there is no good way of
finding the "newline".

"Ivan Demkovitch" <i@a.b> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi!

Here is my problem: I'm inserting script for Trust Logo from one of the

SSL
authorities.
It works fine when I do it in HTML, but I need to build it dynamically:

HtmlTableRow tR = new HtmlTableRow();
HtmlTableCell tC1 = new HtmlTableCell();
tC1.Controls.Add(new LiteralControl("<script
type=\"text/javascript\">TrustLogo(\"https://" +
ConfigurationSettings.AppSettings["DomainName"] +
"/images/secure_site.gif\", \"SC\", \"none\");</script>"));
tR.Cells.Add(tC1);
This doesn't work, gives me error:
CS1010: Newline in constant

How do I do it?


Nov 17 '05 #7

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

Similar topics

11
by: Wentink | last post by:
Does anybody have a simple script that let's me popup a picture from a thumbnail? The ones i found are all very very complicated and messy in the source... Thanks, Tintin
10
by: Douglas Buchanan | last post by:
I am using the following code instead of a very lengthly select case statement. (I have a lot of lookup tables in a settings form that are selected from a ListBox. The data adapters are given a...
9
by: Harry | last post by:
Hi there, does anyone know how I can build a regular expression e.g. for the string.search() function on runtime, depending on the content of variables? Should be something like this: var...
3
by: DaveF | last post by:
I need to put it in a specific place. Here is the old code switch(CAMERA_TYPE_ID) { case "0": case "7": // this is an image
6
by: Tim | last post by:
Hi Guys, I want to build a font like so: headerFont = new Font("Times New Roman", 10, FontStyle.Underline | FontStyle.Bold); It is going to be built dynamically from the DB. How do I build...
0
by: Ivan Demkovitch | last post by:
Hi! Here is my problem: I'm inserting script for Trust Logo from one of the SSL authorities. It works fine when I do it in HTML, but I need to build it dynamically: HtmlTableRow tR = new...
1
by: Russ | last post by:
I've been trying to get my head around this for 3 days now and it seems like everything I try does not work for one reason or another. I built a test page using the TabStrip and MultiPage controls....
2
by: Spam Catcher | last post by:
Is there a way to script VS.NET to copy different app.config along with different build configurations? In fact, it would be great if I could dynamically substitute app.config values for...
8
by: Alexander Llew Wykel | last post by:
I have a project where I load some of my assemblies dynamically, I'm using a venders product where he loads some assemblies dynamically. He loads two assemblies that both share a common name;...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
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...

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.