dtOpenVacancy.AsEnumerable().OrderByDescending(a => a.Field<int>("id"));
IF WANT TO USE WITH GRID DATABASE:-
dtOpenVacancy.AsEnumerable().OrderByDescending(a => a.Field<int>("id")).CopyToDataTable()
or
gridview
private void BindOpenVacancy()
{
DataTable dtOpenVacancy = Repository.GetAllOpenVacancy();
if (dtOpenVacancy.Rows.Count > 0)
{
ViewState["vwOpenVacancy"] = dtOpenVacancy.AsEnumerable().OrderByDescending(a => a.Field<int>("id")).CopyToDataTable();
grdOpenVacancy.DataSource = dtOpenVacancy.AsEnumerable().OrderByDescending(a => a.Field<int>("id")).CopyToDataTable();
}
grdOpenVacancy.DataBind();
}
reference:- https://www.tutorialsteacher.com/linq/linq-sorting-operators-orderby-orderbydescending
No comments:
Post a Comment