473,513 Members | 2,469 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3367
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
2808
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
2287
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
3136
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
2896
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
3538
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
279
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
1454
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
2717
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
1371
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
7260
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
7539
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...
1
7101
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
5686
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,...
1
5090
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4746
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3234
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1597
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
456
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.