我有一个User表,如(Id,Name,UserAddresId)和UserAddress表,如(Id,AddressOne),FormView Control
,我想在其中有一个更新命令。这是我的表格:
<asp:FormView ID="orderInfolst" runat="server" DataKeyNames="Id" DataSourceID="OrderSrc">
<ItemTemplate>
Name:
<asp:Label ID="namelbl" runat="server" Text='<%# Eval("Name") %>' />
User Address One
<asp:Label ID="namelbl" runat="server" Text='<%# Eval("UserAddresses.AddressOne") %>' />
<asp:Button ID="EditButton" runat="server" CausesValidation="False" CommandName="Edit" Text="ویرایش" />
</ItemTemplate>
<EditTemplate>
Name:
<asp:TextBox ID="namelbl" runat="server" Text='<%# Bind("Name") %>' />
User Address One;
<asp:TextBox ID="namelbl" runat="server" Text='<%# Bind("UserAddresses.AddressOne") %>' />
<asp:Button ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update" Text="ویرایش شود" />
<asp:Button ID="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="لغو شود" />
</EditTemplate>
在服务器中我有一个ItemUpdated事件的处理程序,如下所示:
if (e.Exception == null)
{
Resultlbl.Text = "update successfully ";
}
else
{
Resultlbl.Text = e.Exception.Message;
}
我收到更新成功消息。所以名称已更新,但相关表中的 AddressOne 未更新!这有什么不对?