c# - When should Page.Header.DataBind be called? -


i'm trying resolve correct paths javascript scripts in head section using:

<script src="<%# resolveurl("~/scripts/jquery-1.4.2.min.js") %>" type="text/javascript" /> 

in order resolve path need call databind using page.header.databind(); event should place databind call in?

thanks.

reference: http://leedumond.com/blog/the-controls-collection-cannot-be-modified-because-the-control-contains-code-blocks/

when put in page_load article suggests works (only firefox), wonder if correct place.

when follow article ie 8 renders:

<script src="/scripts/jquery-1.4.2.min.js" type="text/javascript" /> 

and firefox 3.6 correctly renders:

<script src="../../scripts/jquery-1.4.2.min.js" type="text/javascript" /> 

update:

fixed browser issues updating script reference in referenced user control use resolveurl. browser issues fixed. still wondering put databind.

change <%# <%=, @ point no longer need call page.header.databind();, since not doing actual databinding in expression.

see this question differences in asp.net tags.

from master page use in projects:

<script type="text/javascript" src='<%= resolveurl("~/js/jquery-1.4.2.min.js") %>' ></script> 

Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -