473,385 Members | 2,274 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

RegisterClientScriptInclude

Tom
I am new to ASP.NET. I am converting a fairly good sized app from classic
to .net. Some of my pages have a lot of controls and javascript functions.
I would like to keep these intact as much as possible. I have put my
javascript
in a seperate file and I am trying to include it using
RegisterClientScriptInclude.
Note, so far I have only been adding files to my web site, I have not
created a 'Project' or web resources or assemblies.

Actually, none of the three methods of inserting code below are working.
What am I missing?

<%@ Page Language="VB" MasterPageFile="Main.master"
AutoEventWireup="false"
title="Login" %>
<script runat="server">
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs)
Dim scriptText As String
scriptText = "return confirm('Do you want to submit the page?')"
ClientScript.RegisterOnSubmitStatement(Me.GetType( ), _
"ConfirmSubmit", scriptText)

Dim myScript As String = "alert(document.forms[0]['usercode'].value);"
Page.ClientScript.RegisterStartupScript(Me.GetType (), "myKey",
myScript, True)

Page.ClientScript.RegisterClientScriptInclude(Me.G etType(),
"LoginJS", "Login.js")
End Sub
</script>

TIA

--
Tom
Feb 17 '06 #1
1 4980
Tom
Well, I tried all the variations on a page which is not
using a master page, and everything works fine.
So, how do I get this to work with a master page?

--
Tom
Feb 17 '06 #2

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

Similar topics

4
by: WT | last post by:
Having questions and problems with this method. I have a control library that embed its .gif and js, html and htc in its ressources Corresponding Attributes are added to the namespace using...
0
by: Dunc | last post by:
Hi, I've got an ASP.NET 2.0 app, and I'm trying to incorporate Google Maps. The app uses nested master pages, so it seems the only way to add a <scripttag to the header block is to use...
8
by: Frank | last post by:
Hi, I am working with VS.NET 2005 Ultimately, I wish to call a JavaScript function from a .js file
3
by: Frank | last post by:
Hi, I simply wish to code a JS function ONCE, in a .js file, include the .js file in the Master page, and then in several but not all pages, I wish to execute the function on pageload. I...
2
by: verci | last post by:
Hi guys, I'm using asp.net 2.0, can anybody send me some complete examples on using ClientScript.RegisterClientScriptInclude and ClientScript.RegisterClientScriptSource, for registering an...
2
by: verci | last post by:
Hi guys, I'm using asp.net 2.0, can anybody send me some complete examples on using ClientScript.RegisterClientScriptInclude and ClientScript.RegisterClientScriptSource, for registering an...
9
by: Dariusz Tomoń | last post by:
Hello, I'd like to include JS from C# code (ASP.NET 2.0). I'm trying not directly from i.e. default.aspx.cs code but from a class belonging to DLL, which is referred in my project. The code...
4
by: Olivier Matrot | last post by:
Hello, I have a problem with an ASP.NET 2.0 Application. A client request is processed in parrallel by two threads. This ends with the following exception : <Source>System</Source> <StackTrace...
1
by: Dave Mathew | last post by:
Is there any way to use RegisterClientScriptInclude to generate the script tags inside of the <headtag? I'm using RegisterClientScriptInclude inside of Page_Load event in the code behind for the...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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...

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.