Amanda Wang - MSFT:Hi,
Base on your description, do you want to add the css for individual page, right?
You can implement it in the content page codebehind, like below:
HtmlLink link = new HtmlLink();
link.href="App_Themes/Theme1/StyleSheet.css";
link.Attributes.Add("type", "text/css");
link.Attributes.Add("rel", "Stylesheet");
link.Attributes.Add("media", "all");
this.Header.Controls.Add(link);
Hope it helps
Thanks, this worked great. How would I go about adding the <script/> tag I had inside the <head/> tag to the page?
Also, in some pages I have that same javascript to show a confirm box in case the user clicks on a button that deletes a database record:
<script type="text/javascript" language="javascript">
function confirm_delete()
{
var temp = confirm("Are you sure you want to delete??");
document.getElementById('<%= hiddenField1.ClientID %>').value = temp;
return temp;
}
</script> When I use the above solution to link a css page, I get the following runtime error:
The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).
And its pointing to the line that reads
this.Header.Controls.Add(link);
What can I do to repair this? Thanks!