Click here to Skip to main content
14,659,434 members
Home » Discussions » ASP.NET
   

ASP.NET

 
AnswerRe: Dashboard Build in .net with Bootstrap Pin
Vinod Jangle9-Feb-18 12:33
MemberVinod Jangle9-Feb-18 12:33 
QuestionAspects Every ASP.Net Developers Must Know Pin
Priyanka Kale8-Feb-18 23:40
MemberPriyanka Kale8-Feb-18 23:40 
AnswerRe: Aspects Every ASP.Net Developers Must Know Pin
Vinod Jangle11-Feb-18 3:28
MemberVinod Jangle11-Feb-18 3:28 
GeneralRe: Aspects Every ASP.Net Developers Must Know Pin
Priyanka Kale14-Mar-18 20:00
MemberPriyanka Kale14-Mar-18 20:00 
QuestionASP.Net MVC application is saying build failed but doesn't show me any error but warns "Found conflicts between different versions of the same dependent assembly" Pin
indian1438-Feb-18 13:24
Memberindian1438-Feb-18 13:24 
QuestionShopping site based on sql data? Pin
JoeJack03308-Feb-18 10:01
MemberJoeJack03308-Feb-18 10:01 
AnswerRe: Shopping site based on sql data? Pin
David Mujica9-Feb-18 3:53
MemberDavid Mujica9-Feb-18 3:53 
QuestionEF: How to minimize search code Pin
Mou_kol8-Feb-18 1:53
MemberMou_kol8-Feb-18 1:53 
QuestionASP.NET Core to IIS Pin
Priyanka Kale7-Feb-18 23:25
MemberPriyanka Kale7-Feb-18 23:25 
AnswerRe: ASP.NET Core to IIS Pin
Vinod Jangle9-Feb-18 12:35
MemberVinod Jangle9-Feb-18 12:35 
QuestionParsing JSON Pin
A_Griffin7-Feb-18 22:40
MemberA_Griffin7-Feb-18 22:40 
AnswerRe: Parsing JSON Pin
F-ES Sitecore7-Feb-18 23:57
mveF-ES Sitecore7-Feb-18 23:57 
GeneralRe: Parsing JSON Pin
A_Griffin8-Feb-18 0:08
MemberA_Griffin8-Feb-18 0:08 
AnswerRe: Parsing JSON Pin
Richard Deeming8-Feb-18 1:01
mveRichard Deeming8-Feb-18 1:01 
QuestionEntityFramework: Can we minimize sorting code Pin
Mou_kol6-Feb-18 2:46
MemberMou_kol6-Feb-18 2:46 
i am fetching data from db using EF. when i fetching then i am filtering and sorting data too.this way i am sorting by column name. huge line i have to write which looks not good.
switch (SortColumn)
    {
        case "CompanyName":
            ViewBag.OldSort = "CompanyName";
            if (SortColumn.Equals(CurrentSort))
            {
                customer = customer.OrderByDescending(m => m.CompanyName);
                ViewBag.CurrentSort = "";
                ViewBag.SortOrder = "desc";
            }
            else
            {
                customer = customer.OrderBy(m => m.CompanyName);
                ViewBag.SortOrder = "asc";
            }
            break;

        case "ContactName":
            ViewBag.OldSort = "ContactName";
            if (SortColumn.Equals(CurrentSort))
            {
                customer = customer.OrderByDescending(m => m.ContactName);
                ViewBag.CurrentSort = "";
                ViewBag.SortOrder = "desc";
            }
            else
            {
                customer = customer.OrderBy(m => m.ContactName);
                ViewBag.SortOrder = "asc";
            }
            break;

        case "ContactTitle":
            ViewBag.OldSort = "ContactTitle";
            if (SortColumn.Equals(CurrentSort))
            {
                customer = customer.OrderByDescending(m => m.ContactTitle);
                ViewBag.CurrentSort = "";
                ViewBag.SortOrder = "desc";
            }
            else
            {
                customer = customer.OrderBy(m => m.ContactTitle);
                ViewBag.SortOrder = "asc";
            }
            break;

        case "Address":
            ViewBag.OldSort = "Address";
            if (SortColumn.Equals(CurrentSort))
            {
                customer = customer.OrderByDescending(m => m.Address);
                ViewBag.CurrentSort = "";
                ViewBag.SortOrder = "desc";
            }
            else
            {
                customer = customer.OrderBy(m => m.Address);
                ViewBag.SortOrder = "asc";
            }
            break;

        case "Default":
            ViewBag.OldSort = "CompanyName";
            customer = customer.OrderBy(m => m.CompanyName);
            ViewBag.SortOrder = "asc";
            break;
    }


please see for 4 columns i have to write so many line of code. suppose if i need to work with 40 columns then how many more line i need to write. so tell me best option to minimize the code for sorting when working with EF.
AnswerRe: EntityFramework: Can we minimize sorting code Pin
Richard Deeming6-Feb-18 3:03
mveRichard Deeming6-Feb-18 3:03 
GeneralRe: EntityFramework: Can we minimize sorting code Pin
Mou_kol7-Feb-18 20:40
MemberMou_kol7-Feb-18 20:40 
GeneralRe: EntityFramework: Can we minimize sorting code Pin
Richard Deeming8-Feb-18 1:39
mveRichard Deeming8-Feb-18 1:39 
GeneralRe: EntityFramework: Can we minimize sorting code Pin
Mou_kol8-Feb-18 1:52
MemberMou_kol8-Feb-18 1:52 
GeneralRe: EntityFramework: Can we minimize sorting code Pin
Richard Deeming8-Feb-18 1:58
mveRichard Deeming8-Feb-18 1:58 
QuestionAny free health monitoring dashboard exist Pin
Mou_kol5-Feb-18 22:00
MemberMou_kol5-Feb-18 22:00 
AnswerRe: Any free health monitoring dashboard exist Pin
Richard MacCutchan5-Feb-18 23:29
mveRichard MacCutchan5-Feb-18 23:29 
QuestionSending a collection of objects to the view in MVC Pin
Davstr5-Feb-18 4:42
MemberDavstr5-Feb-18 4:42 
AnswerRe: Sending a collection of objects to the view in MVC Pin
Richard Deeming5-Feb-18 8:25
mveRichard Deeming5-Feb-18 8:25 
GeneralRe: Sending a collection of objects to the view in MVC Pin
Davstr5-Feb-18 18:24
MemberDavstr5-Feb-18 18:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.