title: How to conditionally change a control property in the presentation layer
body: <p>I'm not very experienced in ASP.Net, as I work mostly with PHP.
  I'm trying this, but it doesn't work:</p>
  
  <pre><code>&lt;asp:TextBox runat="server" ID="txtAnswer" 
    TextMode='&lt;%# IIf(DataBinder.Eval(Container.DataItem, "DoLargeInput"), "MultiLine", "SingleLine" )%&gt;' Text=''&gt;&lt;/asp:TextBox&gt;
  </code></pre>
  
  <p>DoLargeInput is a boolean. </p>
  
  <p>Why doesn't this work? </p>
  
  <p>I'm gettin the following error:</p>
  
  <pre><code>System.InvalidCastException: Conversion from string "MultiLine" to type 'Integer' is not valid. ---&gt; System.FormatException: Input string was not in a correct format.
     at Microsoft.VisualBasic.CompilerServices.Conversions.ParseDouble(String Value, NumberFormatInfo NumberFormat)
     at Microsoft.VisualBasic.CompilerServices.Conversions.ToInteger(String Value)
     --- End of inner exception stack trace ---
     at Microsoft.VisualBasic.CompilerServices.Conversions.ToInteger(String Value)
     at Microsoft.VisualBasic.CompilerServices.Conversions.ToInteger(Object Value)
     at ASP.profile_questions_aspx.__DataBinding__control6(Object sender, EventArgs e)
     at System.Web.UI.Control.OnDataBinding(EventArgs e)
     at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding)
     at System.Web.UI.Control.DataBind()
     at System.Web.UI.Control.DataBindChildren()
     at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding)
     at System.Web.UI.Control.DataBind()
     at System.Web.UI.WebControls.Repeater.CreateItem(Int32 itemIndex, ListItemType itemType, Boolean dataBind, Object dataItem)
     at System.Web.UI.WebControls.Repeater.CreateControlHierarchy(Boolean useDataSource)
     at System.Web.UI.WebControls.Repeater.OnDataBinding(EventArgs e)
     at System.Web.UI.WebControls.Repeater.DataBind()
     at profile_questions.LoadObjects()
  </code></pre>
  
  <p>Any help would be greatly appreciated. Thanks!</p>