title: ASP.NET : Binding textbox maxlength to Class constant in HTML
body: <p>I am attempting to allow my web designers to use the metadata we have about database fields in the asp.net pages they are creating. The most obvious one is as follows:</p>
  
  <pre><code>&lt;asp:TextBox runat="server" id="txTextBox" MaxLength="&lt;Value From Metadata here&gt;" ... /&gt;
  </code></pre>
  
  <p>All the required metadata is stored in our class objects and is accessible due to its public static nature.</p>
  
  <p>The benefit of this would be that they can set values which</p>
  
  <p><strong>a)</strong> might change without them being aware or caring<br>
  <strong>b)</strong> improve the user experience with very little coding effort</p>
  
  <p>and all without having them need worry about what the value is or where it has come from. This will primarily be used for automatically bound controls - i.e. ones which are added with little or no developer interaction. </p>
  
  <p>This question is very similar to <a href="https://stackoverflow.com/questions/232986/xaml-binding-textbox-maxlength-to-class-constant">One of my previous questions</a> which now works wonderfully (but that was in WPF / XAML ).</p>
  
  <p>The main point of this question is that I want as little developer requirement on this as possible - Ideally there would be some <code>&lt;%# Constant.Value %&gt;</code> type syntax which could be used directly within the <code>Maxlength=""</code> attribute of the asp:Textbox control meaning that no code needs to be added to a page/usercontrol at all.</p>
  
  <p>I have a feeling it isn't possible, but I would love someone to prove me wrong.</p>
  
  <p>Ta</p>