?
Solved

DataGridView / DataTable - Sort by row errors

Posted on 2006-07-13
2
Medium Priority
?
677 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 14

Accepted Solution

by:
Ramuncikas earned 2000 total points
ID: 17106104
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
ID: 17134083
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

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses

800 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