title: using <%= %> or <%# %> with runat=server in ASP.NET
body: <p>I have a web control that looks like this</p>
  
  <pre>
  public class Foo : WebControl
  {
    [Bindable(true)]
    [Category("Default")]
    [DefaultValue("")]
    [Localizable(true)]
    public string Bar { get; set; }
  
    protected override void Render(HtmlTextWriter output)
    {
      output.WriteLine(Bar);
    }
  }
  </pre>
  
  <p>I want to put this webcontrol in my aspx page like so:</p>
  
  <pre>
  &lt;cc1:Foo Bar="&lt;%= Fa.La.La %>/otherstuff" runat="server" />
  </pre>
  
  <p>(obviously this code is simplified to show the problem)</p>
  
  <p>In my Render method the variable Fa.La.La is not evaluated.  It's coming in as the raw text "&lt;%= Fa.La.La %>" How do I evaluate it?  </p>
  
  <p>I'm not particular how the variables are passed in. If the variables can be evaluated if they are passed in as &lt;%# ... %>, that works fine.  The point is I have some server-side variables I want evaluated before/while my Render() method is called.</p>
  
  <p>The only thing I can think of is to use a regex to grab the contents of &lt;%= ... %> and use reflection or something, but there has to be a more elegant way to do this.</p>
  
  <p>This question is pretty similar to <a href="https://stackoverflow.com/q/4306850/24267">using server variables in a href &lt;%= xx %&gt; with runat=server</a>, but it's not exactly the same since none of the answers there were useful.</p>