473,659 Members | 3,592 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

RegisterStartup Script not creating a <SCRIPT> block

When I do this in my page...
ClientScript.Re gisterStartupSc ript(this.GetTy pe(), "SomeScript ",
"alert(\"Hi there\");");

it doesn't work AND when I view source, the alert() line is dumped into the
HTML but with no <SCRIPT> block around it. Why would this be happening?

Alex

Apr 30 '06 #1
4 2215
"Alex Maghen" <Al********@new sgroup.nospam> wrote in message
news:F9******** *************** ***********@mic rosoft.com...
When I do this in my page...
ClientScript.Re gisterStartupSc ript(this.GetTy pe(), "SomeScript ",
"alert(\"Hi there\");");

it doesn't work AND when I view source, the alert() line is dumped into
the
HTML but with no <SCRIPT> block around it. Why would this be happening?


It doesn't add the script blocks, it simply adds what ever you've specified
to the page just before the closing form tag for the page. You must include
the script tags around your client side script yourself.

ClientScript.Re gisterStartupSc ript(this.GetTy pe(), "SomeScript ",
"<script>alert( \"Hi there\");</" + "script>");
Apr 30 '06 #2
Alex Maghen wrote:
When I do this in my page...
ClientScript.Re gisterStartupSc ript(this.GetTy pe(), "SomeScript ",
"alert(\"Hi there\");");

it doesn't work AND when I view source, the alert() line is dumped into the
HTML but with no <SCRIPT> block around it. Why would this be happening?


Because you haven't specified that it should add script tags.

ClientScript.Re gisterStartupSc ript(this.GetTy pe(), "SomeScript ",
"alert(\"Hi there\");", true);
Apr 30 '06 #3

"Göran Andersson" <gu***@guffa.co m> wrote in message
news:Or******** ******@TK2MSFTN GP02.phx.gbl...
Alex Maghen wrote:
When I do this in my page...
ClientScript.Re gisterStartupSc ript(this.GetTy pe(), "SomeScript ",
"alert(\"Hi there\");");

it doesn't work AND when I view source, the alert() line is dumped into
the HTML but with no <SCRIPT> block around it. Why would this be
happening?


Because you haven't specified that it should add script tags.

ClientScript.Re gisterStartupSc ript(this.GetTy pe(), "SomeScript ",
"alert(\"Hi there\");", true);


Cool, I didn't know that the new 2.0 version added tags for you. I should
pay more attention ;-) My earlier post refers to the old
Page.RegisterSt artupScript which didn't add tags and I incorrectly assumed
that this was still the case.
Apr 30 '06 #4
VERY cool. And thanks!

Alex

"Tony B" wrote:

"Göran Andersson" <gu***@guffa.co m> wrote in message
news:Or******** ******@TK2MSFTN GP02.phx.gbl...
Alex Maghen wrote:
When I do this in my page...
ClientScript.Re gisterStartupSc ript(this.GetTy pe(), "SomeScript ",
"alert(\"Hi there\");");

it doesn't work AND when I view source, the alert() line is dumped into
the HTML but with no <SCRIPT> block around it. Why would this be
happening?


Because you haven't specified that it should add script tags.

ClientScript.Re gisterStartupSc ript(this.GetTy pe(), "SomeScript ",
"alert(\"Hi there\");", true);


Cool, I didn't know that the new 2.0 version added tags for you. I should
pay more attention ;-) My earlier post refers to the old
Page.RegisterSt artupScript which didn't add tags and I incorrectly assumed
that this was still the case.

Apr 30 '06 #5

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

Similar topics

2
2258
by: Madhav | last post by:
I have the following statements in my script. ---------------------------------------------------------- textToWrite = "<HTML> \n" + "<HEAD> \n" + "<TITLE>Calendar</TITLE> \n" + "<SCRIPT LANGUAGE=\"JavaScript1.2\"SRC=\"popWin.js\">"+ "</SCRIPT> \n" + "</HEAD> \n" + "<BODY> \n" ; textToWrite += "<\BODY>\n" +
0
1147
by: Tony Hedge | last post by:
Hello, I'm using .NET 1.0 on W2K. In my web app solution I have the following hierarchy: -MyWeb.proj ---\Images ---\Styles ---\US -----Main.aspx -----\Images
1
1454
by: D. Shane Fowlkes | last post by:
I'm a fairly skilled traditional ASP/VB programmer and am learning .NET. I was (recently) surprised to read in a book about declaring and defining all my page Functions in <script runat="server"></script> tags and these tags "should" be after the <html> tag but before the <body> tag. I'm used to writing all of my "logic" including functions, in block delimiter tags such as <% %> above the <html> tag. So, is my method now "old school"...
8
5356
by: Brett Robichaud | last post by:
I understand how code-behind can handle events for a page, but can I call a code-behind method from within a <script> tag in my ASP.Net page, or can I only call methods defined in other <script> sections? I can't seem to figure out the syntax for for calling code-behind directly. The method is within the class my page inherits from and is public, but when I try to call it from my page I get this error: CS1520: Class, struct, or...
9
1714
by: sam.s.kong | last post by:
Hello! I have a JavaScript code like the following. <script> var s = "</script>"; ....
21
8522
by: hemant.singh | last post by:
Hello all, I am try'g to send window.location.href to the server script who will generate dynamic javascript according to the referral name comg in as param Now bcz <script language="javascript" src="NO JAVASCRIPT CAN BE USED HERE" /> So I am see'g If I can use eval todo something what I am doing I have tried almost everything, following is being last one
12
62905
by: Iddo | last post by:
Hi, I am having a strange problem... I have an HTML file which has 2 script tags: 1) <script language="javascript" id="ABC" src="ABC.js" /> 2) <script id="general" language="javascript"> function foo() { alert("aaa"); } </script>
44
2819
by: rhythmace | last post by:
W3C HTML validator passes this: .... <script type="text/javascript" src="foo.js"> <script type="text/javascript"> ....script in here... </script> ....
2
2052
by: -Karl | last post by:
Couls someone please advise me on this error. What I am trying to do is be able to convert an XML document into arrays. I read that the subs & functions have to be in <scripttags. Thanks! Error: BC30456: 'Read_DOM' is not a member of
0
8337
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8851
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
8748
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8628
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6181
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
5650
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4175
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...
1
2754
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
1739
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.