Note that there are some explanatory texts on larger screens.

plurals
  1. POHow does FormView EditTemplate update values in ObjectDataSource UpdateParameters under the hood?
    primarykey
    data
    text
    <p>I have a FormView bound to an ObjectDataSource.</p> <p><strong>* ObjectDataSource definition (omitted portion of it for simplicity)*</strong></p> <pre><code>&lt;asp:ObjectDataSource ID="odsHousehold" runat="server" TypeName="BLL.Households" ConflictDetection="OverwriteChanges" UpdateMethod="UpdateHousehold" &gt; &lt;UpdateParameters&gt; &lt;asp:Parameter Name="sName" Type="String" Direction="Input" /&gt; &lt;asp:Parameter Name="sAddress" Type="String" Direction="Input" DefaultValue="" /&gt; &lt;asp:Parameter Name="sCity" Type="String" Direction="Input" DefaultValue="" /&gt; &lt;asp:Parameter Name="sState" Type="String" Direction="Input" DefaultValue="" /&gt; &lt;asp:Parameter Name="sZip" Type="String" Direction="Input" DefaultValue="" /&gt; &lt;/UpdateParameters&gt; &lt;/asp:ObjectDataSource&gt; </code></pre> <p><strong>* FormView definition (omitted portion of it for simplicity) *</strong></p> <pre><code> &lt;asp:FormView ID="fvHousehold" runat="server" DataKeyNames="HouseholdID" DataSourceID="odsHousehold" HorizontalAlign = "Left" &gt; &lt;EditItemTemplate&gt; &lt;asp:TextBox ID="txtHouseHoldName" runat="server" MaxLength="50" Width="100%" Text='&lt;%# Bind("HouseholdName") %&gt;'&gt;&lt;/asp:TextBox&gt; &lt;asp:TextBox ID="txtAddress" runat="server" MaxLength="50" Width="100%" Text='&lt;%# Bind("Address") %&gt;'&gt;&lt;/asp:TextBox&gt; &lt;asp:TextBox ID="txtCity" runat="server" MaxLength="50" Width="100%" Text='&lt;%# Bind("City") %&gt;'&gt;&lt;/asp:TextBox&gt; &lt;asp:TextBox ID="txtState" runat="server" MaxLength="50" Width="100%" Text='&lt;%# Bind("State") %&gt;'&gt;&lt;/asp:TextBox&gt; &lt;asp:TextBox ID="txtZip" runat="server" MaxLength="50" Width="100%" Text='&lt;%# Bind("Zip") %&gt;'&gt;&lt;/asp:TextBox&gt; &lt;asp:Button ID="btnUpdateHousehold" runat="server" Text="Update" CommandName="Update" /&gt; &lt;/EditItemTemplate&gt; &lt;/asp:FormView&gt; </code></pre> <p><strong><em>I'd like to know: how does the FormView know which UpdateParameter to populate with which EditTemplate TextBox when the Update button is clicked?<br/> For instance, I haven't instructed "txtAddress" in the FormView to populate the UpdateParameter "sAddress" but InputParameters["sAddress"] contains the Text value of txtAddress. How does it know to do that? <br/></em></strong> <br/> Could any guru enlighten me?</p> <p>Thank you so much,</p> <p>Cullen</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload