Example #1
0
    //Filling Zones



    /// <summary>
    /// sorts the grid based on sort expression and sort direction
    /// </summary>
    /// <typeparam name="T"> Type</typeparam>
    /// <param name="gvObject">Gridview</param>
    /// <param name="sDir">sortDirection</param>
    /// <param name="sortExpr">sortExpression</param>
    /// <param name="collection">List of Items with genericcollection</param>
    public static void GridSort <T>(GridView gvObject, SortDirection sDir, string sortExpr, GenericCollection <T> collection)
    {
        GenericCollection <T> .GenericComparer comparer = new GenericCollection <T> .GenericComparer(sortExpr, sDir);

        collection.Sort(comparer);
        gvObject.DataSource = collection;
        gvObject.DataBind();
    }