473,672 Members | 2,944 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.Ad d(new LiteralControl( "<script
type=\"text/javascript\">Tr ustLogo(\"https ://" +
ConfigurationSe ttings.AppSetti ngs["DomainName "] +
"/images/secure_site.gif \", \"SC\", \"none\");</script>"));
tR.Cells.Add(tC 1);
This doesn't work, gives me error:
CS1010: Newline in constant

How do I do it?
Nov 17 '05 #1
6 3392
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.Ad d(new LiteralControl( "<script
type=\"text/javascript\">Tr ustLogo(\"https ://" +
ConfigurationSe ttings.AppSetti ngs["DomanName"] + "/images/secure_site.gif \",
\"SC\", \"none\");</script>"));

tR.Cells.Add(tC 1);

// For readability...
String jscript;

Jscript = "<script type=\"text/javascript\">";
Jscript += "TrustLogo(\"ht tps://";
Jscript += ConfigurationSe ttings.AppSetti ngs["DomanName"];
Jscript += "/images/secure_site.gif \", \"SC\", \"none\");"; Jscript +=
"</script>"

tC1.Controls.Ad d(new LiteralControl( Jscript));

Hope this helps.

"Ivan Demkovitch" <i@a.b> wrote in message
news:%2******** ********@TK2MSF TNGP09.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.Ad d(new LiteralControl( "<script
type=\"text/javascript\">Tr ustLogo(\"https ://" +
ConfigurationSe ttings.AppSetti ngs["DomainName "] +
"/images/secure_site.gif \", \"SC\", \"none\");</script>"));
tR.Cells.Add(tC 1);
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.Ad d(new LiteralControl( "<script
type=\"text/javascript\">Tr ustLogo(\"https ://" +
ConfigurationSe ttings.AppSetti ngs["DomanName"] + "/images/secure_site.gif \",
\"SC\", \"none\");</script>"));

tR.Cells.Add(tC 1);

// For readability...
String jscript;

Jscript = "<script type=\"text/javascript\">";
Jscript += "TrustLogo(\"ht tps://";
Jscript += ConfigurationSe ttings.AppSetti ngs["DomanName"];
Jscript += "/images/secure_site.gif \", \"SC\", \"none\");"; Jscript +=
"</script>"

tC1.Controls.Ad d(new LiteralControl( Jscript));

Hope this helps.

"Ivan Demkovitch" <i@a.b> wrote in message
news:%2******** ********@TK2MSF TNGP09.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.Ad d(new LiteralControl( "<script
type=\"text/javascript\">Tr ustLogo(\"https ://" +
ConfigurationSe ttings.AppSetti ngs["DomainName "] +
"/images/secure_site.gif \", \"SC\", \"none\");</script>"));
tR.Cells.Add(tC 1);
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******** ********@TK2MSF TNGP09.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.Ad d(new LiteralControl( "<script
type=\"text/javascript\">Tr ustLogo(\"https ://" +
ConfigurationSe ttings.AppSetti ngs["DomainName "] +
"/images/secure_site.gif \", \"SC\", \"none\");</script>"));
tR.Cells.Add(tC 1);
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******** ********@TK2MSF TNGP09.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.Ad d(new LiteralControl( "<script
type=\"text/javascript\">Tr ustLogo(\"https ://" +
ConfigurationSe ttings.AppSetti ngs["DomainName "] +
"/images/secure_site.gif \", \"SC\", \"none\");</script>"));
tR.Cells.Add(tC 1);
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\">Tr ustLogo(\"https ://" +
ConfigurationSe ttings.AppSetti ngs["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******** ********@TK2MSF TNGP09.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.Ad d(new LiteralControl( "<script
type=\"text/javascript\">Tr ustLogo(\"https ://" +
ConfigurationSe ttings.AppSetti ngs["DomainName "] +
"/images/secure_site.gif \", \"SC\", \"none\");</script>"));
tR.Cells.Add(tC 1);
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*******@bell south.net> wrote in message
news:uE******** ******@tk2msftn gp13.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\">Tr ustLogo(\"https ://" +
ConfigurationSe ttings.AppSetti ngs["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******** ********@TK2MSF TNGP09.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.Ad d(new LiteralControl( "<script
type=\"text/javascript\">Tr ustLogo(\"https ://" +
ConfigurationSe ttings.AppSetti ngs["DomainName "] +
"/images/secure_site.gif \", \"SC\", \"none\");</script>"));
tR.Cells.Add(tC 1);
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
2821
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
2326
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 similar name to the table. Rather than making a long Select Case that could become obsolete if lookup tables are added and the source table of the ListBox is edited I came up with this code.) This code works but of course it gives me build...
9
3148
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 strkey = "something"; var str = "Somethin like this"; if( str.search( / + strkey + / ) > -1 )
3
2901
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
3553
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 the styles dynamically. In the above example it has underline and bold, it could also have italics, or none of them, or a different combination.
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 HtmlTableRow(); HtmlTableCell tC1 = new HtmlTableCell(); tC1.Controls.Add(new LiteralControl("<script type=\"text/javascript\">TrustLogo(\"https://" +
1
1459
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. The example shows how to put up pictures in each tab, and it works fine. But of course I don't want pictures, I want a webform where the data is different in each tab/view. The form could be different in each tab too, but for now I'll settle...
2
2726
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 different deployment scenarios. Any tips or tools to do this? Thanks!
8
1377
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; however have different public keys and version numbers. I receive an error when I compile the my assembly (the dynamic one) it tells me to us the vendors other version of the product, Which is completely wrong since the items I need aren't even in...
0
8503
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8944
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
7469
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6254
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4239
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4439
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2836
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 we have to send another system
2
2091
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1835
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.