SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So I have this line: lvwp.ListViewXml.OrderBy.. - after this I have no Idea what to write?

I would like to assign something like:

Combining like this:

lvwp.ListViewXml.OrderBy<FieldRef Name='Index' Ascending='TRUE' />(); 

will ofcourse not work

I have looked at: http://msdn.microsoft.com/en-us/library/system.linq.enumerable.orderby.aspx , but I just dont get it, Im pretty new with programming and dont really understand concepts like Enumerable and generics

Anyway, is there a simple answer to this?

share|improve this question

ListViewXml is of type string, so you should not use Linq at all on it.

It should be set with a string containing CAML

Something like this:

lvwp.ListViewXml = "<Query><Where>YOUR FILTER CAML IF NEEDED</Where><OrderBy><FieldRef Name='Index' Ascending='TRUE' /></OrderBy><Query>"
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.