Hello,
I am creating a string using StringBuilder:
Dim code As New StringBuilder
code.Append("<script type=""text/javascript""><!--")
Response.Write(code.ToString)
However, I don't get any code when I do Response.Write.
I thinks it is because of "".
Could someone, please, help me out with this?
Thanks,
Miguel 4 2296
the quick answer is that you don't need double quotes for javascript - try
this:
Dim code As New StringBuilder
code.Append("<script type='text/javascript'><!--")
Response.Write(code.ToString)
"shapper" <md*****@gmail.comwrote in message
news:11**********************@16g2000cwy.googlegro ups.com...
Hello,
I am creating a string using StringBuilder:
Dim code As New StringBuilder
code.Append("<script type=""text/javascript""><!--")
Response.Write(code.ToString)
However, I don't get any code when I do Response.Write.
I thinks it is because of "".
Could someone, please, help me out with this?
Thanks,
Miguel
On 17 Dez., 21:38, "shapper" <mdmo...@gmail.comwrote:
Hello,
I am creating a string using StringBuilder:
Dim code As New StringBuilder
code.Append("<script type=""text/javascript""><!--")
Response.Write(code.ToString)
However, I don't get any code when I do Response.Write.
I thinks it is because of "".
Could someone, please, help me out with this?
Thanks,
Miguel
Hello,
why do you want to write the script.tag to the page? The double quotes
are not hte problem because you have masked them correctly.
The String IS written to the page but because its a javascript , its
not visible direclty. Look at the html-sourcecode and you will see it
at the top of the page.
A better way to register scripts on a page is the function
Page.RegisterClientScriptBlock to register a script which is executed
directly. Use this function for script-functions you want to calllater.
You cant access page-controls at this time because they are still
loading.
If you want to access page-controls use the .net-function
Page.RegisterStartupScript which will be executed when the page is
loaded.
Regards,
Tim
Hi,
I know about RegisterClientScriptBlock. The problem is that I am
creating a control thats ads a Google AdSense ad to the page.
So, if I am not wrong, I need to add the code exactly to the place on
my page where I want the add to be.
For this reason by custom control includes a literal where text is
equal to Google AdSense code which can be as follows:
<script type="text/javascript"><!--
google_ad_client = "pub-xxxxxxxxxxxxxxxx";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_type = "image";
google_ad_channel = "";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
Anyway, is this the right way to do this?
Any sugestion will be welcome.
Thanks,
Miguel
TiSch wrote:
On 17 Dez., 21:38, "shapper" <mdmo...@gmail.comwrote:
Hello,
I am creating a string using StringBuilder:
Dim code As New StringBuilder
code.Append("<script type=""text/javascript""><!--")
Response.Write(code.ToString)
However, I don't get any code when I do Response.Write.
I thinks it is because of "".
Could someone, please, help me out with this?
Thanks,
Miguel
Hello,
why do you want to write the script.tag to the page? The double quotes
are not hte problem because you have masked them correctly.
The String IS written to the page but because its a javascript , its
not visible direclty. Look at the html-sourcecode and you will see it
at the top of the page.
A better way to register scripts on a page is the function
Page.RegisterClientScriptBlock to register a script which is executed
directly. Use this function for script-functions you want to calllater.
You cant access page-controls at this time because they are still
loading.
If you want to access page-controls use the .net-function
Page.RegisterStartupScript which will be executed when the page is
loaded.
Regards,
Tim
On 17 Dez., 23:21, "shapper" <mdmo...@gmail.comwrote:
Hi,
I know about RegisterClientScriptBlock. The problem is that I am
creating a control thats ads a Google AdSense ad to the page.
So, if I am not wrong, I need to add the code exactly to the place on
my page where I want the add to be.
For this reason by custom control includes a literal where text is
equal to Google AdSense code which can be as follows:
<script type="text/javascript"><!--
google_ad_client = "pub-xxxxxxxxxxxxxxxx";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_type = "image";
google_ad_channel = "";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
Anyway, is this the right way to do this?
Any sugestion will be welcome.
Thanks,
Miguel
TiSch wrote:
On 17 Dez., 21:38, "shapper" <mdmo...@gmail.comwrote:
Hello,
I am creating a string using StringBuilder:
Dim code As New StringBuilder
code.Append("<script type=""text/javascript""><!--")
Response.Write(code.ToString)
However, I don't get any code when I do Response.Write.
I thinks it is because of "".
Could someone, please, help me out with this?
Thanks,
Miguel
Hello,
why do you want to write the script.tag to the page? The double quotes
are not hte problem because you have masked them correctly.
The String IS written to the page but because its a javascript , its
not visible direclty. Look at the html-sourcecode and you will see it
at the top of the page.
A better way to register scripts on a page is the function
Page.RegisterClientScriptBlock to register a script which is executed
directly. Use this function for script-functions you want to calllater.
You cant access page-controls at this time because they are still
loading.
If you want to access page-controls use the .net-function
Page.RegisterStartupScript which will be executed when the page is
loaded.
Regards,
Tim
Hi,
im not familiar with google adsense but you can add the script where
ever you want for exaple:
Dim script As String = vbCrLf & _
"<script type=""text/javascript""
language=""JavaScript""
src=""http://pagead2.googlesyndication.com/pagead/show_ads.js>" &
vbCrLf & _
" google_ad_client = ""pub-xxxxxxxxxxxxxxxx"";" &
vbCrLf & _
" google_ad_width = 728;" & vbCrLf & _
" google_ad_height = 90;" & vbCrLf & _
" google_ad_format = ""728x90_as"";" & vbCrLf & _
" google_ad_type = ""image"";" & vbCrLf & _
" google_ad_channel = """";" & vbCrLf & _
"</script>"
Me.PlaceHolder1.Controls.Add(New LiteralControl(script))
Ragards,
Tim This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Martin Robins |
last post by:
I am trying to parse a string that is similar in form to an OLEDB connection string using regular expressions; in principle it is working, but certain character combinations in the string being...
|
by: José Joye |
last post by:
Hello,
I was wondering if there is a method that exists to replace multi-spaces
within a string with single-space.
eg:
"12 3 4 56" --> "12 3 4 56"
I think this could be done by...
|
by: genc_ymeri |
last post by:
Hi over there,
Propably this subject is discussed over and over several times. I did google
it too but I was a little bit surprised what I read on internet when it
comes 'when to use what'.
Most...
|
by: Mantorok |
last post by:
Hi all
I have a plain text string, sometimes the string will contain special
characters, how can I encode this string in xml format?
Thanks
Kev
|
by: James Page |
last post by:
Hi all
I have a shopping cart object which I'd like to send the contents via an
e-mail.
I get an error saying 'hybridDictionary' cannot be converted to string.
Does anyone know how to do...
|
by: shapper |
last post by:
Hello,
How can I transform a Generic List(Of String) to a string as follows:
"value1,value2,value3,value4, ..."
Thanks,
Miguel
|
by: simonZ |
last post by:
I have array variable transfer: String transfer which has some data
Than I would like to convert this data into string:
Which way is more efficient:
StringBuilder rezult=new StringBuilder();
...
|
by: ApeX |
last post by:
Hi guys, i hace a question
i have a datagrid
col1 col2
-----------------
D text0
text1
text2
D text3
|
by: TazaTek |
last post by:
Hello,
I've seen some vague references on how to do this a factory, but not
in enough detail to create one, or even know if it's what I need.
Essentially, I'll have one of about 5 classes that...
|
by: xzzy |
last post by:
None of the following properly do the VB.net double quote conversion because
all of the following in csharp convert to
\" instead of just a double quote: "
I have tried:
char...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |