Solved

DataGridView / DataTable - Sort by row errors

Posted on 2006-07-13
2
675 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 500 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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Syntax Issue with SSIS module 26 144
SSIS Feed MS SQL Server Stored procedure with loop 4 60
Open a link in vb.net 2 27
Reactjs with .NET 3 78
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

730 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