title: How to sort a Json array c#
body: <p>I've got a time problem.
  And although I have a project on autonomous because one of our developers has failed. The Project was implemented in C # Asp.Net MVC. And I have actually not as much to do with it since I'm actually rather responsible for Mobiele applications.
  And then I have found the solution always on the look but I'm just simply not on.</p>
  
  <p>And it is so we call on to get data from the database and pass it to a jqgrid. I know this because there are probably problems with the General Order. But I am now only at times between a solution. I want to sort the arry issue and indeed descending.</p>
  
  <p>ah yes sorry for the bad english.</p>
  
  <p>find attached the code from the controller:</p>
  
  <pre><code>enter code here  public class KalkulationController : BaseController
  {
      private IOrderedEnumerable&lt;KalkulationMasterModel&gt; array;
  
      #region JSON
  
      public virtual ActionResult List( string sidx, string sord, int page, int rows, decimal? anr)
      {
  
          if (!anr.HasValue)
              return null;
  
          var service = new KalkulationMasterService();
  
          var listOfKalkulation = service.GetListOfKalkulation(anr, Nutzer);
        //  array = listOfKalkulation.OrderByDescending(c =&gt; c);
          var jsonData = new 
                             {
                                 total = 0,
                                 page = page,
                                 records = 10,
                                 rows = (
                                            listOfKalkulation.Select(k =&gt; new 
                                                                              {
                                                                                  i = k.AuftragId,
                                                                                //  k.OrderBy(k =&gt; k.Id);
                                                                                  cell = new string[]
                                                                                             {
                                                                                                 k.Id.ToString(),
                                                                                                 k.AuftragId.HasValue?k.AuftragId.Value.ToString():null,
                                                                                                 k.Bestellnummer.HasValue?k.Bestellnummer.Value.ToString():null,
                                                                                                 k.NumberOfArt.HasValue?k.NumberOfArt.Value.ToString():null,
                                                                                                 k.LT.HasValue ? k.LT.Value.ToString() : null,
                                                                                                 k.AAStatus??string.Empty,
                                                                                                 k.Los.ToString(),
                                                                                                 //k.Einheit,          
                                                                                                 //String.Format("{0:0.00}",k.Gesamtgewicht),                                                                                                   
                                                                                                 //String.Format("{0:0.00}",k.Preis),
                                                                                                 String.Format("{0:0.00}",k.KundenPreis),
                                                                                                 String.Format("{0:0.00}",k.KorekturPreis),                                                                                                   
                                                                                                 k.ArtikelNr.ToString()
                                                                                             }
  
                                                                              })).ToArray()
  
                             };
  
          return Json(jsonData, JsonRequestBehavior.AllowGet);
  </code></pre>