Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > How to put Javascript in a page using masterpage

Reply
Thread Tools

How to put Javascript in a page using masterpage

 
 
rockdale
Guest
Posts: n/a
 
      09-01-2006
Hi,

I have a page which use a masterpage.
And I put a javascript in this page like below:

<%@ Page Language="C#" MasterPageFile="~/SITE.master"
CodeFile="TEST.aspx.cs" Inherits="TEST_aspx" Title="TEST Javascript" %>
<script type="text/javascript" language="javascript">
DOING SOMETHING WITH OBJECTS THAT EXIST ONLY IN TEST PAGE
BUT NOT IN MASTER PAGE

}
</script>
<asp:content contentplaceholderid="PageContent" runat="Server">
.......


But I hit the error, Error:
Validation (XHTML 1.0 Transitional): Content is not supported outside
'script' or 'asp:content' regions.

It will cause error "Object not found" as these objects do not exist in
master page if I put this javascript into my masterpage.

How to solve this problem?

Thanks
-Rockdale


I tried to put this javascript

 
Reply With Quote
 
 
 
 
bruce barker \(sqlwork.com\)
Guest
Posts: n/a
 
      09-01-2006
following the directions in the error, and place the script inside the
<asp:content> tag. because you are using content area and a master page, the
id will be prefixed with the master and content area names. you should use
ClientId to get the actual rendered names.

-- bruce (sqlwork.com)


"rockdale" <> wrote in message
news: ups.com...
> Hi,
>
> I have a page which use a masterpage.
> And I put a javascript in this page like below:
>
> <%@ Page Language="C#" MasterPageFile="~/SITE.master"
> CodeFile="TEST.aspx.cs" Inherits="TEST_aspx" Title="TEST Javascript" %>
> <script type="text/javascript" language="javascript">
> DOING SOMETHING WITH OBJECTS THAT EXIST ONLY IN TEST PAGE
> BUT NOT IN MASTER PAGE
>
> }
> </script>
> <asp:content contentplaceholderid="PageContent" runat="Server">
> ......
>
>
> But I hit the error, Error:
> Validation (XHTML 1.0 Transitional): Content is not supported outside
> 'script' or 'asp:content' regions.
>
> It will cause error "Object not found" as these objects do not exist in
> master page if I put this javascript into my masterpage.
>
> How to solve this problem?
>
> Thanks
> -Rockdale
>
>
> I tried to put this javascript
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calling Page.UICulture / Page.Culture from MasterPage code Savvoulidis Iordanis ASP .Net 2 06-30-2009 07:04 AM
Post to another page (MasterPage, In JavaScript) Cat ASP .Net 6 07-20-2008 07:35 PM
how can i call javascript from masterpage ? Vino_Gays ASP .Net 0 08-10-2007 08:41 AM
open pdf or othe page link into content page in masterpage Shailesh Patel ASP .Net 2 11-15-2006 07:14 PM
MasterPage -> Page -> MasterPage Code Access =?Utf-8?B?QWxleCBNYWdoZW4=?= ASP .Net 3 04-14-2006 12:34 PM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57