PC Review


Reply
Thread Tools Rate Thread

Databinding to a DAL with ObjectDataSource-control: Update OK, Deletenot (debug info provided) please help!

 
 
cmrchs@gmail.com
Guest
Posts: n/a
 
      31st Jul 2008
Hi,

I'm trying out Databinding to a Data Acces Layer using a GridView and
ObjectDataSource-control

The Update works fine but the Delete-method doesn't ???

<asp:GridView ID="GridView1" runat="server"
DataSourceID="ObjectDataSource1"
OnRowUpdating="GridView1_RowUpdating"
OnRowUpdated="GridView1_RowUpdated"
OnRowDeleting="GridView1_RowDeleting"
OnRowDeleted="GridView1_RowDeleted" />

<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
TypeName="ProductsDB"
SelectMethod="SelectProducts" InsertMethod="InsertProduct"
UpdateMethod="UpdateProduct"
DeleteMethod="DeleteProduct" DataObjectTypeName="Product"
OnUpdating="ObjectDataSource1_Updating"
OnUpdated="ObjectDataSource1_Updated"
OnDeleting="ObjectDataSource1_Deleting"
OnDeleted="ObjectDataSource1_Deleted" >
</asp:ObjectDataSource>

Following is a printout of some debugged events, so events raised in
the gridView, the ObjectDataSource, the Business Object 'Product' and
the data Acces Layer class 'ProductsDB'

The Update works fine: (I click Update on the 3rd row (= index 2)
containing Product: ID=3 Name='Aniseed S'

GRIDVIEW1_ROWCOMMAND: RowIndex=2 CommandName=Update
GRIDVIEW1_ROWUPDATING: ProductID=3 OldProductName='Aniseed S'
NewProductName='Aniseed Syrup'
PRODUCT CLASS: DEFAULT CTOR
PRODUCT CLASS: PROPERTY SET PRODUCTID
PRODUCT CLASS: PROPERTY GET PRODUCTID: ProductID=3
OBJECTDATASOURCE1_UPDATING:
ProductID=3 ProductName='Aniseed Syrup'
PRODUCT CLASS: PROPERTY GET PRODUCTID: ProductID=3
ProductsDB class (data layer class): UPDATEPRODUCT ProductID=3
ProductName=Aniseed Syrup
PRODUCT CLASS: PROPERTY GET PRODUCTID: ProductID=3
OBJECTDATASOURCE1_UPDATED:
GRIDVIEW1_ROWUPDATED: ProductID=3 OldProductName='Aniseed S'
NewProductName='Aniseed Syrup'


But the Delete doesn't work: (Delete on the 3rd row (= index 2)
containing Product: ID=3 Name='Aniseed Syrup'

GRIDVIEW1_ROWCOMMAND: RowIndex=2 CommandName=Delete
GRIDVIEW1_ROWDELETING: ProductID=3 ProductName=Aniseed Syrup //
UNTIL HERE EVERYTHING OK
PRODUCT CLASS: DEFAULT CTOR
PRODUCT CLASS: PROPERTY GET PRODUCTID: ProductID=0 // PRODUCT INFO
IS LOST ???
OBJECTDATASOURCE1_DELETING:
ProductID=0 ProductName=
PRODUCT CLASS: PROPERTY GET PRODUCTID: ProductID=0
ProductsDB Class (data layer class): DELETEPRODUCT ProductID=0
ProductName=
//
NO PRODUCT TO DELETE IN DAL
PRODUCT CLASS: PROPERTY GET PRODUCTID: ProductID=0
OBJECTDATASOURCE1_DELETING:
GRIDVIEW1_ROWDELETED: ProductID=3 ProductName=Aniseed Syrup

even before calling the Delete method in the DAL, the product-object
is not correctly constructed

how come?

thank you
Chris
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Databinding to a DAL with ObjectDataSource-control: Update OK, DeleteNot OK ??? cmrchs@gmail.com Microsoft ASP .NET 5 31st Jul 2008 05:43 PM
Webbrowser control's link and image info not provided kimiraikkonen Microsoft VB .NET 2 3rd Feb 2008 10:52 AM
ObjectDataSource with Complex Objects and 2 way Databinding =?Utf-8?B?VHJhaWwgTW9uc3Rlcg==?= Microsoft ASP .NET 5 12th Jan 2007 10:53 PM
Databinding problems with ObjectDataSource Richard Carpenter Microsoft ASP .NET 0 18th Jul 2006 06:09 PM
Asp.net databinding to objectdatasource =?Utf-8?B?UmFt?= Microsoft ASP .NET 2 1st Dec 2005 05:49 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:06 PM.