Solved

DataGridView / DataTable - Sort by row errors

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

Quiz: What Do These Organizations Have In Common?

Hint: Their teams ended up taking quizzes, too.

Question has a verified solution.

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

Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

726 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