471,066 Members | 1,341 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

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 4174
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
reply views Thread by leo001 | last post: by

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.