468,115 Members | 2,111 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,115 developers. It's quick & easy.

RegisterClientScriptInclude and master page

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 master page and it generates the tags to the page
ok, however it puts them inside where the <formtag begins on the
page and not inside the head tag

In the code behind:
cs.RegisterClientScriptInclude("master",
ResolveClientUrl("~/javascript/master.js"));

What gets rendered to the browser:

<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>
Untitled Page
</title><link rel="stylesheet" type="text/css" href="../stylesheets/
main.css" />
<title>Page Title</title>
</head>
<body>
<form name="aspnetForm" method="post" action="Default.aspx"
id="aspnetForm">
<script src="../javascript/master.js" type="text/javascript"></
script>
Oct 28 '08 #1
1 4090
no.

RegisterClientScriptBlock & RegisterClientScriptInclude, always come after
the form, before any form content. RegisterStartupScript is rendered before
the closing tag.

you can put a placeholder inside the <headand render your own script, but
any server controls will still call the Register routines
-- bruce (sqlwork.com)
"Dave Mathew" wrote:
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 master page and it generates the tags to the page
ok, however it puts them inside where the <formtag begins on the
page and not inside the head tag

In the code behind:
cs.RegisterClientScriptInclude("master",
ResolveClientUrl("~/javascript/master.js"));

What gets rendered to the browser:

<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>
Untitled Page
</title><link rel="stylesheet" type="text/css" href="../stylesheets/
main.css" />
<title>Page Title</title>
</head>
<body>
<form name="aspnetForm" method="post" action="Default.aspx"
id="aspnetForm">
<script src="../javascript/master.js" type="text/javascript"></
script>
Oct 28 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by tcc.se7en | last post: by
4 posts views Thread by lichaoir | last post: by
6 posts views Thread by =?Utf-8?B?SmF5IFBvbmR5?= | last post: by
5 posts views Thread by =?Utf-8?B?bXVzb3NkZXY=?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.