title: Gridview EditItemTemplate with an If statement inside bind C#
body: <p>I tried a ton of solutions for problem: binding a textbox if the value is a number or null if it's anything else...</p>
  
  <p>i have this textbox inside an EditItemTemplate </p>
  
  <pre><code>&lt;asp:TextBox ID="TextBox2" runat="server" Text='&lt;%# Bind("Position") %&gt;'&gt;&lt;/asp:TextBox&gt;
  </code></pre>
  
  <p>i tried to assign rangevalidators, regex validation but nothing works: it keeps erroring out when i try a non-number (like 'p' or 'word')</p>
  
  <p>What i try to do is something like this:</p>
  
  <pre><code>&lt;asp:TextBox ID="TextBox2" runat="server" Text='&lt;%# if (It is number) Bind("Position") else Bind("Null") %&gt;'&gt;&lt;/asp:TextBox&gt;
  </code></pre>
  
  <p>or something like this:</p>
  
  <pre><code>&lt;asp:TextBox ID="TextBox2" runat="server" Text='&lt;%# if (It is number) Bind("Position") else Bind("0") %&gt;'&gt;&lt;/asp:TextBox&gt;
  </code></pre>
  
  <p>Thanks everyone</p>
  
  <p>PS: im using C#</p>