PC Review


Reply
Thread Tools Rate Thread

dataview.sort not working in framework 1.1

 
 
Archana
Guest
Posts: n/a
 
      17th Aug 2007
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.

 
Reply With Quote
 
 
 
 
=?Utf-8?B?S2VycnkgTW9vcm1hbg==?=
Guest
Posts: n/a
 
      17th Aug 2007
Archana,

The datatable's defaultview is what get's sorted, which is happening. That
is why it appears sorted in the grid: the grid displays the defaultview.

Kerry Moorman


"Archana" wrote:

> 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.
>
>

 
Reply With Quote
 
James
Guest
Posts: n/a
 
      17th Aug 2007
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

 
Reply With Quote
 
Archana
Guest
Posts: n/a
 
      17th Aug 2007
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.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dataview Sort not working =?Utf-8?B?V2hpc2t5Um9tZW8=?= Microsoft Dot NET Framework Forms 2 19th Jan 2006 09:28 PM
Dataview sort not working Peter Proost Microsoft VB .NET 3 3rd Mar 2005 04:03 PM
Dataview will not sort Raymond Lewallen Microsoft ADO .NET 9 8th Nov 2004 08:18 PM
Dataview will not sort Raymond Lewallen Microsoft Dot NET 9 8th Nov 2004 08:18 PM
DataView sort fails to sort on fields with comma in field names Mone Hsieh Microsoft ADO .NET 1 14th May 2004 09:29 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:24 PM.