1

(Id,Name,UserAddresId) のような User テーブルと (Id,AddressOne) のような UserAddress テーブル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="ویرایش شود" />
                          &nbsp;<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;
}    

更新が正常に完了しましたというメッセージが表示されます。そのため、Name フィールドは更新されましたが、関連する Table のAddressOneは更新されません!!! ここで何が問題なのですか?

4

0 に答える 0