It's an intriguing issue at hand. The error message indicates that the string
<%= WebApplication1.SiteHelper.IsUserInRole("Admin") %>
cannot be converted to a boolean.
Unfortunately, I am unable to clarify why the expression isn't evaluated as intended, but is instead treated as a string.
The reason why your <%# %>
expression functions correctly is because it undergoes a different treatment. During compilation of the Page into a class, the compiler generates an event handler like this:
public void __DataBindingButton2(object sender, EventArgs e)
{
Button button = (Button) sender;
Page bindingContainer = (Page) button.BindingContainer;
button.Visible = HttpContext.Current.User.IsInRole("admin");
}
This method is then attached to the Control.Databinding event on your control. As demonstrated, the <%# %>
is appropriately recognized as server-side code, not simply as a random string.
Therefore, it seems that using databinding or following AndreasKnudsen's advice to modify the codebehind could be potential solutions.