Esempio n. 1
0
    protected void gvMedicine_Sorting(object sender, GridViewSortEventArgs e)
    {
        BindGridDataMedicine();
        DataTable dt = LINQToDataTable(dc.GetMedicine());
        // dt = ds.Tables[0];
        string SortDir = string.Empty;

        if (dir == SortDirection.Ascending)
        {
            dir     = SortDirection.Descending;
            SortDir = "Desc";
        }
        else
        {
            dir     = SortDirection.Ascending;
            SortDir = "Asc";
        }
        DataView sortedView = new DataView(dt);

        sortedView.Sort       = e.SortExpression + " " + SortDir;
        gvMedicine.DataSource = sortedView;
        gvMedicine.DataBind();
    }