New Posts New Posts RSS Feed: UserDeletingRow event doesn't fire
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

UserDeletingRow event doesn't fire

 Post Reply Post Reply
Author
DataMan View Drop Down
Groupie
Groupie
Avatar

Joined: 26-Jul-2007
Location: Canada
Posts: 52
Post Options Post Options   Quote DataMan Quote  Post ReplyReply Direct Link To This Post Topic: UserDeletingRow event doesn't fire
    Posted: 15-Feb-2008 at 3:05pm
So weird issue that I have, if I click on a row on a MS data grid and hit the delete key it doesn't do anything.
 
I even opened the end_adddeletebusinessobjets instructional unit and I have exactly the same code.  The example doesn't delete either?
 
Putting a breakpoint in the UserDeletingRow shows that it doesn't get into the code.
 
Allowusertodeleterows is set to true
 
Any suggestions?
 
 
Back to Top
DataMan View Drop Down
Groupie
Groupie
Avatar

Joined: 26-Jul-2007
Location: Canada
Posts: 52
Post Options Post Options   Quote DataMan Quote  Post ReplyReply Direct Link To This Post Posted: 19-Feb-2008 at 9:18am
So I found out the reason that the event does not fire is that the collection is read only due to the relationship of master detail being read only.  If I create a new grid bound to the orderdetail table and not the linked binding source then the deleting event fires.
 
I could filter this new grid and use it instead of the grid bound to the linked binding sources but that adds complexity.
 
On page 77 of 498 of the developers guide is the following:  "Accordingly, we leave it to the developer to write an OrderDetail setter if such a setter should exist at all. "

Can anyone give me an example of how to write a setter for order detail?  After writing this setter will the bound grid let me delete and the functionality return to normal for selecting the rows and hitting the delete button.

Thanks
Back to Top
DataMan View Drop Down
Groupie
Groupie
Avatar

Joined: 26-Jul-2007
Location: Canada
Posts: 52
Post Options Post Options   Quote DataMan Quote  Post ReplyReply Direct Link To This Post Posted: 19-Feb-2008 at 12:25pm

Ok,  so diving even further in I think I've answered my own question and this is interesting for new people to ideablade to get info on the subject.

What I've found is that you cannot chain the binding sources together and have the user be able to click on a row and hit the delete key.  The relationship between parent and child is read-only therefore it doesn't work.
 
 
The documentation in a readme.doc in the solution folder tells us that but in a round about way
 
"What is the difference between the two solutions in the “Orders on User Control - No Chaining” folder?  Simply the mechanism by which adds and deletes are accomplished.   In the “AddDeleteWithBNOnChildGridInUserControl” solution, a BindingNavigator is provided for the Orders grid, and its AddNewItem and DeleteItem buttons are used for adding and deleting Orders.  In the “AddDeleteWithNewItemRowOnChildGridInUserControl” solution, the “NewItem” row at the bottom of the grid is enabled and is used for adding new Orders.  To delete an Order, you select the row and press the DEL key."
 
In the first example by chaining your binding sources you can't delete a row with the delete key,  your users have to use the binding navigator.
 
The solution that solved all my issues is:
 
C:\Program Files\IdeaBlade DevForce\Instructional Units\200 Intermediate\Add-Delete On Child Grid\02 Code CSharp\Orders on User Control - No Chaining\AddDeleteWithNewItemRowOnChildGridInUserControl
 
The answer was there I just had to find it.  Hoping this saves someone else time.  The developer guide on page 77 could be changed to say that if you don't chain your binding sources you can delete or something.
 
 
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down