I stumbled upon another issue. I am sure there is a good reason they decided to not allow this, but I found it quite frustrating to learn it the hard way. Server Control tags, like for a button, or TextBox or any other server control, can not contain .net code <% … %>. For example:
<asp:Button ID=”btnRefreshLayout” runat=”server” Text=”Refresh Layout” OnClientClick=”AdjustFrameDim(<%= _layout%>);” OnClick=”btnRefreshLayout_Click” />
The result is…
<input type=”submit” name=”btnRefreshLayout” value=”Refresh Layout” onclick=”AdjustFrameDim(<%= _layout%>);” id=”BI_TabControl1_ucLayout_btnRefreshLayout” />
It doesn’t seem to matter where in the server control code you put the <% … %>, it doesn’t work.
BUT, I have good news… If you need to dynamically add something to the properties of the server control, you could instead use the AddAttribute method of the server control and get the needed results that way.
btnRefreshLayout.Attributes.Add(“OnClick”, “AdjustFrameDim(“ + _layout + “);”);
Happy Coding.