Re: Custom Sorting a DataTable Using DataGrid

From: ClayB [Syncfusion] (clayb_at_syncfusion.com)
Date: 08/19/04

  • Next message: ClayB [Syncfusion]: "Re: KeyPress Event not Firing???"
    Date: Thu, 19 Aug 2004 04:36:51 -0400
    
    

    I think the code in the previous post does work to sort according to string
    length, but the sample data generated does not illustrate this well since
    the length sorting for the generated data is the same as the default
    sorting. If you use this loop to generate the sample data, then two sorts
    give different results and thus better illustrate the idea.

    =========================
    Clay Burch, .NET MVP

    Visit www.syncfusion.com for the coolest tools

    for(int i = 0; i < nRows; ++i)

    {

    DataRow dr = dt.NewRow();

    for(int j = 0; j < nCols; j++)

    if(i % 2 == 0)

    dr[j] = new MyObject("row" + new string('a', 1 + r.Next(10)));

    else

    dr[j] = new MyObject("a" + new string('a', 1 + r.Next(10)));

    dt.Rows.Add(dr);

    }


  • Next message: ClayB [Syncfusion]: "Re: KeyPress Event not Firing???"

    Relevant Pages

    • Re: Exracting numerical data.
      ... Based on your sample data - if it is all in one column (but with rows ... irregularly between them) - then I would select the whole column and "Sort". ... I know there are available add-in user functions based on a loop ... The irregular spacing is for real. ...
      (microsoft.public.excel)
    • Re: ORDER BY Issues
      ... Is the field truly alphanumeric as the sample data you show is all ... If the field in the database is not a numerical type you can try ... > I have an alphanumeric field I'm trying to sort by, ... > the way ADO sorts. ...
      (microsoft.public.vb.database.ado)
    • Re: Query sort not working after NULL column
      ... Provide some sample data where the sort isn't working right. ... Jerry Whittle, Microsoft Access MVP ... > Hope someone can shed light on this? ...
      (microsoft.public.access.queries)
    • Re: Sorting without grouping
      ... >sort on date. ... >totals are on Monthly Rate. ... Sample data below which I hope clarifies. ... I don't think you're missing something obvious. ...
      (microsoft.public.access.reports)
    • Re: Puzzle: Know Your Data
      ... I'm glad UV came up with hsolution, as mine was going to be similar, but involving the German double s that looks (sort of) like a Greek beta. ... strings, and you want to sort them but in a case-insensitive manner. ... # convert the strings to lowercase when comparing ... The puzzle to you is to determine the reason and sample data that ...
      (perl.beginners)