Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# DataGridView
I have a form where I am populating laundry details for the customer from the database onto datagridview.I want to mark these rows as disabled i.e grayed out , so that the user is unable to select these rows.
 
I have tried a few things such as making these rows read-only,making datagridview disable.I want to make only a few rows disabled(those fetched from database) rest of the rows where user makes a new data entry should be enabled/selected.
 
Appreciate any Help.
Please provide the code/examples.
 
Thanks
Cheers
Smile | :)
Posted 18-Mar-10 18:46pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

project99 wrote:
Please provide the code/examples.

 
Because if we tell you what to do, you won't know enough C# to understand us ?
 
Why does making them read only not work ? What if you render them the way you want to, and as a seperate thing, catch the mouse/kb actions related to those rows and reject them without allowing an edit ?
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Don't post fake answers, edit your post. You obviously need to do what I said then, handle the events that start the delete process, check if the row is read only, and if so, stop the delete. Nothing else is going to work.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 5

"You have mistaken the above was not my answer but a reply to your qs as why not read-only."
 
As I said, BECAUSE it's not an answer, don't push the button with ANSWER written on it, but instead, edit your post to add the detail.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

User is still able to delete the read-only rows.
The rows fetched from the DB are only a view to the user(user should not be able to make any action on them) but at the same time any new dataentry that the user makes should be selectable,can be deleted.
 
How do i tap the mouse/kb actions on rows from DB and then reject them.
 
Thanks for your Help.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

You have mistaken the above was not my answer but a reply to your qs as why not read-only.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 6

Why don't you use 2 separate datagrids. One for viewing previous orders and another to create new orders. Surely this would be a better way to go. You can make the first on completely uneditable(is this a word?).
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Maciej Los 225
1 OriginalGriff 140
2 Sergey Alexandrovich Kryukov 137
3 _Amy 115
4 manoj kumar choubey 115
0 OriginalGriff 7,320
1 Sergey Alexandrovich Kryukov 6,043
2 Maciej Los 3,749
3 Peter Leow 3,408
4 DamithSL 2,555


Advertise | Privacy | Mobile
Web04 | 2.8.140721.1 | Last Updated 19 Mar 2010
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100