title: Adding Jquery to aspx page when Master page has already declared Jquery
body: <p>I need some help figuring out the best way to go about adding jquery code to my aspx file. We have a big front end solution in VS2008 using a master page. In the master page we have a ContentPlaceHolder where you can add stuff to the <code>&lt;head&gt;</code>, but the location of the place holder is above the code which declares the local path to jquery. Would I need to move the ContentPlaceHolder to a location below the jquery? If so, couldn't doing that cause some potential issues? I tried adding an additional ContentPlaceHolder under the script declaration tags, but that caused ViewState errors (I think having to do with code behind I added for my page to allow CSS3 for IE). </p>
  
  <p>Here is the relevant code from the master file:</p>
  
  <pre><code>&lt;%@ Master Language="C#" AutoEventWireup="True" CodeBehind="Class.Master.cs" Inherits="Company.Project.Masters.Class" %&gt;
  
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head id="Head1" runat="server"&gt;
  
  &lt;title&gt;&lt;%# Page.Title %&gt;&lt;/title&gt;
  &lt;meta http-equiv="X-UA-Compatible" content="IE=8" /&gt;
  &lt;asp:ContentPlaceHolder ID="cphHead" runat="server" &gt;
      &lt;/asp:ContentPlaceHolder&gt;
  &lt;link href="~/inc/style.css" rel="stylesheet" type="text/css" /&gt;
  &lt;script src='&lt;%# ResolveUrl("~/inc/utils.js") %&gt;' type="text/javascript"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
  //some js stuff here
  &lt;style type="text/css"&gt;
          // some css stuff here
  &lt;/style&gt;
  
  &lt;script language="javascript" type="text/javascript" src='local/path/to/jquery' &gt;&lt;/script&gt;
  &lt;script language="javascript" type="text/javascript" src='local/path/to/jquery-ui-1.10.3.custom.min.js") %&gt;'&gt;&lt;/script&gt;
  
  &lt;script type="text/javascript"&gt;
      $(document).ready(function() {      
          //some jquery stuff here
          })
      }); 
  &lt;/script&gt;
  &lt;/head&gt;
  </code></pre>
  
  <p>Below is the code I have added to my page's .cs file to allow CSS3 elements to work in IE. This error looks like it is related to the ViewState error </p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
  {     
         HtmlMeta xuac = new HtmlMeta();
          xuac.HttpEquiv = "X-UA-Compatible";
          xuac.Content = "IE=edge";
          Header.Controls.AddAt(0, xuac);
  }
  </code></pre>
  
  <p>When I add a new ContentPlaceHolder in the MasterPage I get the error: </p>
  
  <blockquote>
    <p>Failed to load viewstate.  The control tree into which viewstate is
    being loaded must match the control tree that was used to save
    viewstate during the previous request.  For example, when adding
    controls dynamically, the controls added during a post-back must match
    the type and position of the controls added during the initial
    request.</p>
  </blockquote>