public static void GridSortInitail(string sortDirection, string sortExpr, GridView grdReport, int formName, object objCollection) { string strSortDir = null; try { switch (sortDirection) { case "Ascending": strSortDir = "ASC"; break; case "Descending": strSortDir = "DESC"; break; } //Appending arrow symbol to the grid header according to the sorting. GridSorting.AppendSortOrderImageToGridHeader("Ascending", sortExpr, ref grdReport); GridSortingEx(0, strSortDir, sortExpr, ref grdReport, objCollection); //Add data to the GridView //GridSorting.MakeAccessible(grdReport); } catch (Exception ex) { //bool rethrow = ExceptionPolicy.HandleException(ex, ARSConstants.StrPerDatumUIPolicy); //if (rethrow) // throw; ////Redirecting to error message page //HttpContext.Current.Server.Transfer(ARSConstants.StrErrorPageURL); } }
/// <summary> /// This event is used to sort the contents of the grid /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public static void GridSort(HtmlInputHidden txthdnSortOrder, GridViewSortEventArgs e, GridView grdReport, int formName, object objCollection) { string strSortDir = null; try { //storing the value in hidden variable if (txthdnSortOrder.Value.Length == 0) { txthdnSortOrder.Value = e.SortDirection.ToString(); } //To reverse the sort order if (txthdnSortOrder.Value.Length != 0) { if (txthdnSortOrder.Value == "Ascending") { txthdnSortOrder.Value = "Descending"; } else { txthdnSortOrder.Value = "Ascending"; } } //checking the condition and sorting accordingly switch (txthdnSortOrder.Value) { case "Ascending": strSortDir = "ASC"; break; case "Descending": strSortDir = "DESC"; break; } //Appending arrow symbol to the grid header according to the sorting. GridSorting.AppendSortOrderImageToGridHeader(txthdnSortOrder.Value, e.SortExpression, ref grdReport); GridSortingEx(formName, strSortDir, e.SortExpression, ref grdReport, objCollection); //Add data to the GridView //GridSorting.MakeAccessible(grdReport); } catch (Exception ex) { //bool rethrow = ExceptionPolicy.HandleException(ex, ARSConstants.StrPerDatumUIPolicy); //if (rethrow) // throw; ////Redirecting to error message page //HttpContext.Current.Server.Transfer(ARSConstants.StrErrorPageURL); } }
public static void GridSortForReport(HtmlInputHidden txthdnSortOrder, string eSortExp, GridView grdReport, int formName, object objCollection, string SortDirec) { string strSortDir = null; try { txthdnSortOrder.Value = SortDirec; //checking the condition and sorting accordingly switch (txthdnSortOrder.Value) { case "Ascending": strSortDir = "ASC"; break; case "Descending": strSortDir = "DESC"; break; } //Appending arrow symbol to the grid header according to the sorting. GridSorting.AppendSortOrderImageToGridHeader(txthdnSortOrder.Value, eSortExp, ref grdReport); GridSortingEx(formName, strSortDir, eSortExp, ref grdReport, objCollection); //Add data to the GridView //GridSorting.MakeAccessible(grdReport); } catch (Exception ex) { //bool rethrow = ExceptionPolicy.HandleException(ex, ARSConstants.StrPerDatumUIPolicy); //if (rethrow) // throw; ////Redirecting to error message page //HttpContext.Current.Server.Transfer(ARSConstants.StrErrorPageURL); } }