none
Datasource order changed while sorting and grouping in server side. RRS feed

  • Question

  • Hi All, 

    We have tried asp sorting and grouping the datasource the order will be changed. But in client side working fine. We have attached code snippet below.

    List<accs> acc = new List<accs>();

                acc.Add(new accs() { Account = "4320", Content = "Invest" });

                acc.Add(new accs() { Account = "4290", Content = "rewrw" });

                acc.Add(new accs() { Account = "4290", Content = "test11" });

        

                var list = acc.OrderBy(x => x.Content);

                var t = list.GroupBy(p => p.Account, p => p.Content, (key, g) => new { Account = key, Content = g.ToList() });

    return View();

    serverside output:

    0-Account="4320"

    1-Account="4290"

    ClientSide output:

    0-Account="4290"

    1-Account="4320"

    Please let me know if you have any solution.

    Regards,

    Gopi G.

    Thursday, November 2, 2017 1:27 PM

Answers