FormViewをObjectDataSourceにバインドしました。FormView EditTemplateは、どのようにしてObjectDataSource UpdateParametersの値を更新しますか?
*のObjectDataSource定義(簡単のためその省略部分)*
<asp:ObjectDataSource
ID="odsHousehold"
runat="server"
TypeName="BLL.Households"
ConflictDetection="OverwriteChanges"
UpdateMethod="UpdateHousehold"
>
<UpdateParameters>
<asp:Parameter Name="sName" Type="String" Direction="Input" />
<asp:Parameter Name="sAddress" Type="String" Direction="Input" DefaultValue="" />
<asp:Parameter Name="sCity" Type="String" Direction="Input" DefaultValue="" />
<asp:Parameter Name="sState" Type="String" Direction="Input" DefaultValue="" />
<asp:Parameter Name="sZip" Type="String" Direction="Input" DefaultValue="" />
</UpdateParameters>
</asp:ObjectDataSource>
* FormViewコントロール定義(簡単のためその省略部分)*
<asp:FormView
ID="fvHousehold"
runat="server"
DataKeyNames="HouseholdID"
DataSourceID="odsHousehold"
HorizontalAlign = "Left"
>
<EditItemTemplate>
<asp:TextBox ID="txtHouseHoldName" runat="server" MaxLength="50" Width="100%" Text='<%# Bind("HouseholdName") %>'></asp:TextBox>
<asp:TextBox ID="txtAddress" runat="server" MaxLength="50" Width="100%" Text='<%# Bind("Address") %>'></asp:TextBox>
<asp:TextBox ID="txtCity" runat="server" MaxLength="50" Width="100%" Text='<%# Bind("City") %>'></asp:TextBox>
<asp:TextBox ID="txtState" runat="server" MaxLength="50" Width="100%" Text='<%# Bind("State") %>'></asp:TextBox>
<asp:TextBox ID="txtZip" runat="server" MaxLength="50" Width="100%" Text='<%# Bind("Zip") %>'></asp:TextBox>
<asp:Button ID="btnUpdateHousehold" runat="server" Text="Update" CommandName="Update" />
</EditItemTemplate>
</asp:FormView>
I」はどのように、どのUpdateParameterにどのEditTemplate TextBoxを挿入するかをFormViewが知っていますか?クリックされましたか?
例えば、私はFormViewの "txtAddress"にUpdateParameter "sAddress"を設定するよう指示していませんが、InputParameters ["sAddress"]にはtxtAddressのText値が含まれています。それをどうやって知っていますか?
私に教えてもらえますか?
はカレン
このコードはあなたのために働くのですか?学問的な理由から「どのように」求めているのですか、それともあなたが望むように縛られていないからですか? –