title: EditItemTemplate: a conditional binding
body: <p>According to a specific row value (Type), I must use a TextBox or a DropDownlist inside an EditTemplateField (only ONE of them).
  How can I bind conditionally controls inside the EditItemTemplate in order to tell the UpdateMethod which is the control to take into consideration for the field "Value"?</p>
  
  <pre><code>&lt;asp:TemplateField&gt;
      &lt;ItemTemplate&gt;
          &lt;asp:Label ID="LabelType" runat="server" Text='&lt;%# Eval("Type") %&gt;'&gt;&lt;/asp:Label&gt;
      &lt;/ItemTemplate&gt;
      &lt;EditItemTemplate&gt;
          &lt;asp:Label ID="LabelType" runat="server" Text='&lt;%# Eval("Type") %&gt;'&gt;&lt;/asp:Label&gt;
      &lt;/EditItemTemplate&gt;
  &lt;/asp:TemplateField&gt;
  &lt;asp:TemplateField &gt;
      &lt;ItemTemplate&gt;
          &lt;asp:Label ID="LabelValue" runat="server" Text='&lt;%# Eval("Value") %&gt;'&gt;&lt;/asp:Label&gt;
      &lt;/ItemTemplate&gt;
      &lt;EditItemTemplate&gt;
          &lt;div style="text-align:center"&gt;
              &lt;asp:TextBox ID="TextBoxValue" runat="server" Text='&lt;%# Bind("Value") %&gt;'&gt;&lt;/asp:TextBox&gt;
              &lt;asp:DropDownList ID="DropDownListValue" runat="server" SelectedValue='&lt;%# Bind("Value") %&gt;'&gt;
              &lt;/asp:DropDownList&gt;
          &lt;/div&gt;
      &lt;/EditItemTemplate&gt;
  &lt;/asp:TemplateField&gt;
  </code></pre>
  
  <p>The GridView's UpdateMethod has "Value" as input parameter and it must be able to decide if taking it from DropDownListValue or TextBoxValue.</p>
  
  <pre><code>&lt;asp:ObjectDataSource ID="ODSResults" runat="server" 
      SelectMethod="GetDataByIdDevice" 
      TypeName="DataSetSWCTableAdapters.DispositivoParametro_TableAdapter" 
      UpdateMethod="Save"&gt;
      &lt;SelectParameters&gt;
          &lt;asp:QueryStringParameter Name="IdDevice" QueryStringField="id" Type="Int32" /&gt;
          &lt;asp:ProfileParameter Name="Culture" PropertyName="Cultura" Type="String" /&gt;
          &lt;asp:Parameter Name="ParameterCode" Type="String" /&gt;
      &lt;/SelectParameters&gt;
      &lt;UpdateParameters&gt;
          &lt;asp:Parameter Name="IdDevice" Type="Int32" /&gt;
          &lt;asp:Parameter Name="IdParameter" Type="Int32" /&gt;
          &lt;asp:Parameter Name="Value" Type="Int64" /&gt;
      &lt;/UpdateParameters&gt;
  &lt;/asp:ObjectDataSource&gt;
  </code></pre>
  
  <p>I tried to hide/show the controls TextBoxValue and DropDownListValue (using the property "Visible") but it does not work: UI is fine but the UpdateMethod always receives 0 as input value (I guess as result of an empty string casting).</p>