protected void BindContentGrid() { List <App_Code.ContentView> ContentList = new List <App_Code.ContentView>(); if (GridContent.DataSource == null) { ContentList = App_Code.ContentService.ListContent(); } else { ContentList = (List <App_Code.ContentView>)GridContent.DataSource; } string[] SortExp = ViewState["SortExpr"].ToString().Split(' '); if (SortExp[0] == "Category") { if (SortExp[1] == "ASC") { App_Code.ContentView.SortOnCategoryASC SOC = new App_Code.ContentView.SortOnCategoryASC(); ContentList.Sort(SOC); } else { App_Code.ContentView.SortOnCategoryDSC SOC = new App_Code.ContentView.SortOnCategoryDSC(); ContentList.Sort(SOC); } } else if (SortExp[0] == "Title") { if (SortExp[1] == "ASC") { App_Code.ContentView.SortOnLanguagesASC SOC = new App_Code.ContentView.SortOnLanguagesASC(); ContentList.Sort(SOC); } else { App_Code.ContentView.SortOnTitleDSC SOC = new App_Code.ContentView.SortOnTitleDSC(); ContentList.Sort(SOC); } } else if (SortExp[0] == "Author") { if (SortExp[1] == "ASC") { App_Code.ContentView.SortOnAuthorASC SOC = new App_Code.ContentView.SortOnAuthorASC(); ContentList.Sort(SOC); } else { App_Code.ContentView.SortOnAuthorDSC SOC = new App_Code.ContentView.SortOnAuthorDSC(); ContentList.Sort(SOC); } } else if (SortExp[0] == "ModDate") { if (SortExp[1] == "ASC") { App_Code.ContentView.SortOnDateASC SOC = new App_Code.ContentView.SortOnDateASC(); ContentList.Sort(SOC); } else { App_Code.ContentView.SortOnDateDSC SOC = new App_Code.ContentView.SortOnDateDSC(); ContentList.Sort(SOC); } } else if (SortExp[0] == "Versions") { if (SortExp[1] == "ASC") { App_Code.ContentView.SortOnVersionASC SOC = new App_Code.ContentView.SortOnVersionASC(); ContentList.Sort(SOC); } else { App_Code.ContentView.SortOnVersionsDSC SOC = new App_Code.ContentView.SortOnVersionsDSC(); ContentList.Sort(SOC); } } else if (SortExp[0] == "Languages") { if (SortExp[1] == "ASC") { App_Code.ContentView.SortOnLanguagesASC SOC = new App_Code.ContentView.SortOnLanguagesASC(); ContentList.Sort(SOC); } else { App_Code.ContentView.SortOnLanguagesDSC SOC = new App_Code.ContentView.SortOnLanguagesDSC(); ContentList.Sort(SOC); } } GridContent.DataSource = ContentList; GridContent.DataBind(); }