The following code compiles, but doesn\'t work. As far as I know data-binding expressions allow any valid C# code in them. So what am I doing wrong here?
Try this:
Or just switch the order of your inline code snippets:
<% this.myPannel.DataBind(); %>
Or simply use:
<% this.myPannel.CssClass = "my-class";%>
In all three cases, you have to make sure that the control property is updated before the actual inline code of the control is being processed in the page's life cycle.