title: Content Query Web Part - How do you OrderBy when you QueryOverride?
body: <p>How do you order items when you override the <code>QueryOverride</code> property of the Content Query Web Part?</p>
  
  <p>I have been given responsibility for a Web Part which extends the Content Query Web Part. The <code>QueryOverride</code> property of this Web Part is programmatically changed. Currently, the Web Part does not function as designed, as it does not order the items according to the appropriate field.</p>
  
  <p>If I add an <code>&lt;OrderBy&gt;</code> node to the <code>QueryOverride</code> property I get an error message along the lines of 'something wrong with the query this web part is...' and the Content Query Web Part doesn't seem to have an <code>OrderBy</code> property which I could use instead.</p>
  
  <p>The "QueryOverride property" part of <a href="http://msdn.microsoft.com/en-us/library/aa981241.aspx" rel="nofollow noreferrer">this</a> msdn article seems to suggest I should be able to add an <code>&lt;OrderBy&gt;</code> node to the <code>QueryOverride</code> but a number of web sites I've been reading suggest that this is not true.</p>
  
  <p>So, how do you order items when you override the <code>QueryOverride</code> property of the Content Query Web Part?</p>