|
|
|
start date: Fri, 17 Aug 2007 04:18:28 -0700,
posted on: microsoft.public.dotnet.framework.adonet
back
| Thread Index |
|
1
Archana
|
|
2
James
|
|
3
Archana
|
dataview.sort not working in framework 1.1
Hi all,
I am having table containing 2 columns and 3 rows.
Col1 contains interger valye. I have records with record1 having 2 in
col1, record2 having 5 in col1 and record3 having again 2 in col1.
I am trying to sort this datatable. So what i did is
table.defaultview.sort = 'col1 as'. here i am expecting sorted rows as
2,2,5 which is not happening. But when i bind this datatable to
datagrid on gird sorted table is getting displayed. I am not getting
why table is not sorting but in datagrid showing sorted table.
Please help me in sorting table.
thanks in advance.
Date:Fri, 17 Aug 2007 04:18:28 -0700
Author:
|
Re: dataview.sort not working in framework 1.1
Hi Archana
Your problem is that a DataTable is never sorted. Only a DataView is
sortable: the rows in the DataTable never move position. Your code is
correct however you will find that it hasn't changed the ordering of
your table, it has changed the ordering of table.DefaultView. When
you bind a DataTable to a DataGrid, the DataGrid actually works with
the table's DefaultView which is why the data is shown in the order
you want.
James
Date:Fri, 17 Aug 2007 05:49:23 -0700
Author:
|
Re: dataview.sort not working in framework 1.1
Hi,
Thanks for your reply.
Can u tell me then how to sort datatable.? Means from defaultview can
i get sorted datatable?
Because i want table to sorted to do processing.
thanks in advance.
Date:Fri, 17 Aug 2007 05:55:28 -0700
Author:
|
|
|