B
bob
Hi,
I have an object data source attached to a form view. The data source calls
bll's update method. I can't figure out why the bll's update method never
gets updated fields - it always gets original values. I made sure that
fields are two-way bound in the form's <EditItemTemplate>. I don't get any
runtime errors. I set a breakpoint in the update method and can clearly see
that old values are passed to it.
My bll's update method is declared as follows:
[System.ComponentModel.DataObjectMethodAttribute
(System.ComponentModel.DataObjectMethodType.Update, true)]
public bool UpdateItem(int itemID, DateTime startDate, DateTime endDate,
string content);
The form view:
<asp:FormView ID="itemFormView" runat="server" DataKeyNames="ItemID"
DataSourceID="itemDataSource">
<EditItemTemplate>
Start Date:
<asp:TextBox ID="StartDateTextBox" runat="server" Text='<%#
Bind("StartDate") %>'></asp:TextBox><br />
End Date:
<asp:TextBox ID="EndDateTextBox" runat="server" Text='<%#
Bind("EndDate") %>'></asp:TextBox><br />
Content:
<asp:TextBox ID="ContentTextBox" runat="server" Text='<%#
Bind("Content") %>'></asp:TextBox><br />
<asp:LinkButton ID="UpdateButton" runat="server"
CausesValidation="True" CommandName="Update"
Text="Update"></asp:LinkButton>
<asp:LinkButton ID="UpdateCancelButton" runat="server"
CausesValidation="False" CommandName="Cancel"
Text="Cancel"></asp:LinkButton>
</EditItemTemplate>
<InsertItemTemplate>
[...]
</InsertItemTemplate>
<ItemTemplate>
[...]
</ItemTemplate>
</asp:FormView>
<asp:ObjectDataSource ID="itemDataSource" runat="server"
DeleteMethod="DeleteItem"
InsertMethod="AddItem" OldValuesParameterFormatString="{0}"
TypeName="ItemsBLL" UpdateMethod="UpdateItem"
SelectMethod="GetItemByItemID" >
<UpdateParameters>
<asparameter Name="startDate" Type="DateTime" />
<asparameter Name="endDate" Type="DateTime" />
<asparameter Name="content" Type="String" />
</UpdateParameters>
[...]
</asp:ObjectDataSource>
I'd appreciate any help/pointers because I'm stuck at this point.
Thanks,
Bob.
I have an object data source attached to a form view. The data source calls
bll's update method. I can't figure out why the bll's update method never
gets updated fields - it always gets original values. I made sure that
fields are two-way bound in the form's <EditItemTemplate>. I don't get any
runtime errors. I set a breakpoint in the update method and can clearly see
that old values are passed to it.
My bll's update method is declared as follows:
[System.ComponentModel.DataObjectMethodAttribute
(System.ComponentModel.DataObjectMethodType.Update, true)]
public bool UpdateItem(int itemID, DateTime startDate, DateTime endDate,
string content);
The form view:
<asp:FormView ID="itemFormView" runat="server" DataKeyNames="ItemID"
DataSourceID="itemDataSource">
<EditItemTemplate>
Start Date:
<asp:TextBox ID="StartDateTextBox" runat="server" Text='<%#
Bind("StartDate") %>'></asp:TextBox><br />
End Date:
<asp:TextBox ID="EndDateTextBox" runat="server" Text='<%#
Bind("EndDate") %>'></asp:TextBox><br />
Content:
<asp:TextBox ID="ContentTextBox" runat="server" Text='<%#
Bind("Content") %>'></asp:TextBox><br />
<asp:LinkButton ID="UpdateButton" runat="server"
CausesValidation="True" CommandName="Update"
Text="Update"></asp:LinkButton>
<asp:LinkButton ID="UpdateCancelButton" runat="server"
CausesValidation="False" CommandName="Cancel"
Text="Cancel"></asp:LinkButton>
</EditItemTemplate>
<InsertItemTemplate>
[...]
</InsertItemTemplate>
<ItemTemplate>
[...]
</ItemTemplate>
</asp:FormView>
<asp:ObjectDataSource ID="itemDataSource" runat="server"
DeleteMethod="DeleteItem"
InsertMethod="AddItem" OldValuesParameterFormatString="{0}"
TypeName="ItemsBLL" UpdateMethod="UpdateItem"
SelectMethod="GetItemByItemID" >
<UpdateParameters>
<asparameter Name="startDate" Type="DateTime" />
<asparameter Name="endDate" Type="DateTime" />
<asparameter Name="content" Type="String" />
</UpdateParameters>
[...]
</asp:ObjectDataSource>
I'd appreciate any help/pointers because I'm stuck at this point.
Thanks,
Bob.