N
Norbert Ruessmann
Hello group,
I have a business object, which contains Orders. Each Order has a list of
OrderItems. Orders are collected in a list List<Order>, OrderItems for each
order are of type v<OrderItems>. From a database view this is a one to many
relation.
I define two GridView controls: one for displaying/editing the Orders,
another one for displaying/editing the OrderItems. I also define two
datasource controls (ObjectDataSource) for each grid.
The Grid for Orders is selectable, therefore for the DataSource for
OrderItems uses a select method which gets the id of the order selected in
first grid, and as parameter for this method I use the SelectIndex of the
Grid for Orders (there is a tutorial on http://asp.net about how to do this)
.. This works fine. If I select 10 Orders into the grid (from database), and
then select (using 'select' link in grid's row) one of them in the GridView,
the corresponding OrderItems are automatically displayed in the second grid.
Now my problem: I want to edit the OrderItems. I have to specify an update
method which gets an OrderItem object. The class OrderItem must have a
default constructor, which is called by the databinding mechanism internally
before calling the Update method I specified. But: my Update method does not
know which OrderItem needs to be updated.
To undestand this problem: When the form is display, I select all relevant
Oders and their OrderItems into my business objects. Then I use ASP.NET
Session State to keep these Items. When the user wants to edit an item, the
item kept in Session State needs to be updated.
But how do I find the item which needs to be updated? The only solution I
see is that I must search all Orders, and then all OrderItems of each Order,
until I find the item which needs to be updated. But for me this is not a
solution.
Any other ideas, or links for better understanding data binding?
Thanks in advance
Norbert Ruessmann
I have a business object, which contains Orders. Each Order has a list of
OrderItems. Orders are collected in a list List<Order>, OrderItems for each
order are of type v<OrderItems>. From a database view this is a one to many
relation.
I define two GridView controls: one for displaying/editing the Orders,
another one for displaying/editing the OrderItems. I also define two
datasource controls (ObjectDataSource) for each grid.
The Grid for Orders is selectable, therefore for the DataSource for
OrderItems uses a select method which gets the id of the order selected in
first grid, and as parameter for this method I use the SelectIndex of the
Grid for Orders (there is a tutorial on http://asp.net about how to do this)
.. This works fine. If I select 10 Orders into the grid (from database), and
then select (using 'select' link in grid's row) one of them in the GridView,
the corresponding OrderItems are automatically displayed in the second grid.
Now my problem: I want to edit the OrderItems. I have to specify an update
method which gets an OrderItem object. The class OrderItem must have a
default constructor, which is called by the databinding mechanism internally
before calling the Update method I specified. But: my Update method does not
know which OrderItem needs to be updated.
To undestand this problem: When the form is display, I select all relevant
Oders and their OrderItems into my business objects. Then I use ASP.NET
Session State to keep these Items. When the user wants to edit an item, the
item kept in Session State needs to be updated.
But how do I find the item which needs to be updated? The only solution I
see is that I must search all Orders, and then all OrderItems of each Order,
until I find the item which needs to be updated. But for me this is not a
solution.
Any other ideas, or links for better understanding data binding?
Thanks in advance
Norbert Ruessmann