473,498 Members | 2,018 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

RegisterStartupScript() and RegisterClientScriptBlock()

I've been reading the following link :

http://msdn.microsoft.com/library/de...us/dnaspp/html
/aspnet-injectclientsidesc.asp
That supposedly tells you how to use these: RegisterStartupScript() and
RegisterClientScriptBlock() to inject client side script into a server
control.
I'm new to ASP.NET and am hoping someone can help.
I'm trying to get this snippet: <script language="JavaScript1.2"
src="adds/menu/wm_menu.js" type="text/javascript"></script>
to run in my server control.
Here is the code for the control:

<%@ Control Language="VB" %>
<script runat="server">
</script>
<p align="center">
<table height="90" width="100%" align="center" bgcolor="dodgerblue">
<tbody>
<tr>
<td rowspan="3">
<p align="left">
<asp:Image id="logo" runat="server"
ImageUrl="images/logo_wm.gif" ImageAlign="Top"></asp:Image>
</p>
</td>
<td valign="center" align="left" width="50%" colspan="2"
height="50" border="0">
</td>
</tr><script language="JavaScript1.2" src="adds/menu/wm_menu.js"
type="text/javascript"></script> /////// here is where I would like it.
<tr>
<td valign="center" width="50%" colspan="2" height="40"
rowspan="2" border="0">
<p align="center">
<asp:AdRotator id="header" runat="server"
Width="360px" Height="40px"
AdvertisementFile="adds/headerads.xml"></asp:AdRotator>
</p>
</td>
</tr>
<tr>
</tr>
</tbody>
</table>
</p>

CAn anyone help me get this code RegisterStartupScript() and
RegisterClientScriptBlock() to work?

Where does the code go in my control and what is the correct syntax?
Nov 17 '05 #1
1 2908
Hi,

You can use page_load event to take advantage of
RegisterClientScriptBlock.

this.RegisterClientScriptBlock("myScript","<script
language="JavaScript1.2"
src="adds/menu/wm_menu.js" type="text/javascript"></script>
");

Natty Gur[MVP]
Phone Numbers:
Office: +972-(0)9-7740261
Fax: +972-(0)9-7740261
Mobile: +972-(0)58-888377
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #2

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

Similar topics

3
8493
by: Mike P | last post by:
Is there a difference between Page.RegisterClientScriptBlock and Page.RegisterStartupScript? I've seen them both in code examples and they both seem to be doing the same thing. Any help would...
3
8249
by: Lukman | last post by:
Hi, Could you tell me about what is RegisterStartupScript, I try to understand from MSDN sample, but I still don't understand. Could you give me more simple sample ? and what is the purpose of...
6
1968
by: Bill Jones | last post by:
I'm trying to use this.RegisterStartupScript to add some javascript to and aspx page that will run when the page is loaded. Does anyone know if this function only works in the Page_Load function? ...
2
3055
by: sam | last post by:
I am trying to emit script to the response stream within the Application_Error handler in global.asax. I want to emit using Page.RegisterClientScriptBlock. This doesn't work, and I have been...
11
3629
by: Stan Sainte-Rose | last post by:
Hi, I m working on a user control. I need to use a Js file, I would like to know how to load the js file using RegisterStartupScript command from the user control. Also, if I load the same user...
4
2059
by: jef | last post by:
Experienced programmer but new to Web development and ASP.NET. I'm attempting to implement a popup window by way of using the Page.RegisterStartupScript method in my VB code-behind logic (in a...
7
4426
by: sck10 | last post by:
Hello, I have the following sub in a class in my "App_Code" directory. The script is for setting focus on a particular control, but I get the error, "Name ClientScript Not declared". Also, I am...
3
10389
by: MJP | last post by:
I have a button which kicks off the generation of a report after which the file will be downloaded. The report generation can take a long time, so client side onclick event of the button also...
3
6617
by: | last post by:
Hello, I try to open a new Window in code behind with : ClientScript.RegisterClientScriptBlock(this.GetType(), "MyOpenScript", "window.open('toto.doc');", true); My problem is that the new...
0
7121
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
6993
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
7162
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,...
1
6881
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
5456
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
4899
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
4584
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
3088
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
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.