Why can't I set the asp:Label Text property by calling a method in the aspx file? <p>Can somebody please explain this to me:</p> <p>I have a label and I want to be able to set the Text property by calling a method in the aspx file. It works fine if I set the property in code behind, but I really want to set this property in the aspx file. </p> <p>I have tried a couple of things, but what I expected to work was this: </p> <pre><code>&lt;asp:Label ID="Label1" runat="server" Text=&lt;%# GetMyText("LabelText") %&gt; /&gt; </code></pre> <p>I get no errors when doing this, but my method is never called and the Text property is left empty. </p> <p>Is it not possible to set property values to server side controls directly in the aspx without using resources or use hard coded values? </p> <p><strong>Update:</strong> My first try was: </p> <pre><code>&lt;asp:Label ID="Label1" runat="server" Text=&lt;%= GetMyText("LabelText") %&gt; /&gt; </code></pre> <p>But that results in the following error: </p> <blockquote> <p>Server tags cannot contain &lt;% ... %> constructs.</p> </blockquote>