GridView, ObjectDataSource, Update problems.

C

Chris Szabo

Good morning everyone. I have a problem right now using the GridView control
with and ObjectDataSource. It appears as though the new values are not being
passed to the update method, only the original values.

I've stepped through the code, and I can see the new values correctly in the
GridView control, but when the Update method for the ODS is invoked, the
appropriate vales are not passed to the method.

Here is the markup:

<asp:GridView
OnPreRender="gvBom_OnPreRender"
DataSourceID="odsGridSource"
CssClass="dataGrid"
Width="100%"
AutoGenerateColumns="False"
CellPadding="5"
HorizontalAlign="Left"
AutoGenerateEditButton="True"
ID="gvBom"
runat="server">
<RowStyle CssClass="dataGridItemRow" Font-Size="X-Small" />
<HeaderStyle BackColor="#F8F8F8" />
<Columns>
<asp:BoundField Visible="false" DataField="ProductId" />
<asp:BoundField HeaderText="Product"
DataField="PartNumber" />
<asp:BoundField HeaderText="Qty" DataField="Quantity" />
<asp:BoundField HeaderText="Manufacturer"
DataField="Manufacturer" />
<asp:BoundField HeaderText="Clarification"
DataField="Clarification" />
<asp:BoundField HeaderText="Qty Available"
DataField="QuantityAvailable" />
<asp:BoundField HeaderText="Date Available"
DataField="DateAvailable" />
<asp:BoundField HeaderText="Extension"
DataField="Extension" />
</Columns>
</asp:GridView>
<asp:ObjectDataSource
ID="odsGridSource"
runat="server"
UpdateMethod="UpdateBomAddedProduct"
SelectMethod="GetBomAddedProduct"
TypeName="UI.BT.BOM.Processor" >
<UpdateParameters>
<asp:parameter Name="ProductId" Type="Int64" />
<asp:parameter Name="PartNumber" Type="String" />
<asp:parameter Name="Quantity" Type="Int32" />
<asp:parameter Name="Manufacturer" Type="String" />
<asp:parameter Name="Clarification" Type="String" />
<asp:parameter Name="QuantityAvailable" Type="Int32" />
<asp:parameter Name="DateAvailable" Type="DateTime" />
<asp:parameter Name="Extension" Type="Int32" />
</UpdateParameters>
</asp:ObjectDataSource>

And this is the prototype for the method that is invoked in the business tier:

public static void UpdateBomAddedProduct (
Int64 ProductId,
string PartNumber,
int Quantity,
string Manufacturer,
string Clarification,
int QuantityAvailable,
DateTime DateAvailable,
int Extension )
{ }

If a break point is set on this method, it will be hit. But the values
being passed are the old values, not the updated values. Does anyone have
any ideas on why this would happen?

Thanks
 
C

Chris Szabo

I have some more information regarding this problem. The GridView and the
ObjectDataSource are both located in a UserControl. That control is embedded
within a templated cusom control, which is in a different UserControl. The
tree would look like this:

-default.aspx
-------UserControl1
----------CustomControl1
----------------UserControl2
---------------------GridView
---------------------ObjectDataSource

If I copy and paste the GridView and ObjectDataSource into a test.aspx page,
everything functions perfectly. Does anyone know if there are nesting issues
with these controls, or in .NET 2.0 in general?

Thanks for the help again.
 
O

objectdatasource control update

I'm having exactly the same problem. Did you find a fix? Thanks!

Rob
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top