Dynamically assigning properties on a non data bound ASP.NET control
<p>For example, let's say I have a HyperLink:</p>

<pre><code>&lt;asp:HyperLink runat="server" Text="Foo" NavigateUrl="foo.aspx" /&gt;
</code></pre>

<p>How can I set the NavigateUrl on the server side, without having to go the code-behind? </p>

<p>This doesn't work of course:</p>

<pre><code>&lt;asp:HyperLink runat="server" Text="Foo" NavigateUrl="&lt;%= urlString %&gt;" /&gt;
</code></pre>

<p>(where urlString might be a string I created earlier in the page)</p>

<p>And this doesn't work because the HyperLink is not within a data bound control:</p>

<pre><code>&lt;asp:HyperLink runat="server" Text="Foo" NavigateUrl='&lt;%# urlString %&gt;' /&gt;
</code></pre>

<p>I guess I could just use a standard anchor element:</p>

<pre><code>&lt;a href="&lt;%= urlString %&gt;"&gt;Foo&lt;/a&gt;
</code></pre>

<p>But I'd rather not mix up HTML and ASP.NET controls, and it would be handy to be able to do this for other controls.</p>

<p>Surely there must be a way?</p>
