![]() |
|
|
|||||||
![]() |
ASP Net - How to put Javascript in a page using masterpage |
|
|
Thread Tools | Search this Thread |
|
|
#1 |
|
Posts: n/a
|
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 |
|
|
|
#2 |
|
Posts: n/a
|
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 > |
|
![]() |
| Thread Tools | Search this Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| .aspx page apears minimized when pops up | sam.dev | Software | 3 | 02-04-2008 02:04 PM |
| Back button doesn't work when it is a secure page returning to a non secure page | Miss Mary | General Help Related Topics | 1 | 09-21-2007 09:32 AM |
| master page & app_theme folder doesn't work | dummies2 | General Help Related Topics | 0 | 09-04-2007 04:41 PM |
| Unable to Read/Set Text Box in ASPX Web page using Javascript | rameshk75 | Software | 0 | 10-25-2006 02:34 PM |
| Clear the Session value on page unload | tessythampan | Software | 1 | 08-12-2006 11:18 AM |