Solved

DataGridView / DataTable - Sort by row errors

Posted on 2006-07-13
2
671 Views
Last Modified: 2008-01-09
Hi All,

I have a DataTable that I have bound to a DataGridView.  In the DataTable there are several rows where I have manually set the DataRow.RowError property.  

How do I sort the DataTable (or a related DataView), so that the rows with errors are displayed first?

Cheers

Nick
0
Comment
Question by:nickhoggard
2 Comments
 
LVL 14

Accepted Solution

by:
Ramuncikas earned 500 total points
Comment Utility
If you set DataRow.RowError manually then I assume you are itterating through all of the rows and checking for some conditions. What I'd suggest here is:
 - add one extra column to your datatable (let's call it cError) of type Boolean
 - in the iteration process set DataRow("cError") = True along with DataRow.RowError setting
 - the set sorting and filtering in DataTable's Defaultview
 - Bind gridview to DataTable's Defaultview

HTH
R
0
 
LVL 5

Author Comment

by:nickhoggard
Comment Utility
Thanks,

For a moment I was hoping that MS had an internal way of doing this, but that solution has done the job.

Cheers

Nick
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
This video discusses moving either the default database or any database to a new volume.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now