The following code:
aspx file:
<div id="challengedIndependence" class="collegeAccentBlock grid_8 push_1" runat="server" clientidmode="Static" style='display:<%# testMethod %>' >
associated aspx.cs file:
public string testMethod()
{
return "none;";
}
rendered html file:
<div id="challengedIndependence" class="collegeAccentBlock grid_8 push_1" style="display:<%# testMethod %>">
</div>
I am expecting the result to rendder as ...style:"display:none;"... what am I doing wrong.
Not sure if this should be in the same question: I am doing this because I have multiple lines of code to determine whether this div should be displayed. If there is another way of doing this and an explanation as to why it is better I would also accept that answer.
Reference: Inline expressions referenced on MSDN
<%= %>which did not work and I m unsure why. The data binding occurs as file.aspx.cs for file.aspx