473,398 Members | 2,125 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

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

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
Jul 31 '08 #1
0 1856

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: John Bailey | last post by:
Is there a good way to databind a textbox to a date field that will not throw an error when a null is encountered. I tried changing the Null Value in the dataset , but when I do I get the...
0
by: ber.janssens | last post by:
Hi, I am trying the new ObjectDataSource from ASP.NET 2.0. I connected a Gridview with ObjectDataSource which is connected to a webservice which returns a DataSet. In the Webmethod I return...
0
by: Eiriken | last post by:
Hello everyone, I am using ASP.NET 2 and trying to bind a objectdatasource to a gridview. By doing this the most common way by adding an objectdatasource to the page and by using the wizard to...
0
by: David Hubbard | last post by:
I am using a GridView to display a set of objects that have a parent-child relationship. Each object, MyBO, has an ID property that is used to get the children of that object. class MyBO { ...
1
by: Roger | last post by:
Hi all On a page I am using a repeater which is linked to an ObjectDataSource (same page): <asp:Repeater ID="VideoListNewestRepeater" runat="server" DataSourceID="VideoListNewestDataSource">...
2
by: Mike | last post by:
Hi all I'm trying to do something that seem rather simple in theory but just doesn't want to work out. I have a form with a text box used to type in a search criteria, a drop down list used...
2
by: Random | last post by:
I have a very full and complex object that contains objects as properties and a few collections, and I'm working to databind it to a page. A lot of textbox and dropdowns on the page, a few grids. ...
0
by: TheDude5B | last post by:
HI, I am creating a DataList by using the SelectMethod from an ObjectDataSource. Within each item I want to be able to the dynamically create a drop down list depending on what the ProductID is...
1
by: Jay Pondy | last post by:
Given the following List(of Position) objects for an ObjectDataSource Position Description EmployeeA FirstName LastName EmployeeB FirstName LastName
3
by: btreddy | last post by:
Hii all, I've a problem regarding passing select parameters to objectdatasource from code behind. i would like to pass the select parameters to a objectdatasource ..not in the selecting or...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.