RegisterClientScriptInclude and master page

D

Dave Mathew

Is there any way to use RegisterClientScriptInclude to generate the
script tags inside of the <head> tag?

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 <form> tag 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>
 
B

bruce barker

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 <head> and render your own script, but
any server controls will still call the Register routines


-- bruce (sqlwork.com)
 

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

Top