RegisterClientScriptInclude

G

Guest

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.GetType(),
"LoginJS", "Login.js")
End Sub
</script>

TIA
 
G

Guest

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top