We are migrating ASP.NET project from version 2.0 to 4.0
In previous version i had a specified below line of code:
<asp:CheckBox runat="server" ID="chkContentFilter"
Text="<%# SearchResultDictionary.ContentFilter %>"
OnCheckedChanged="chkFilterCheckbox_ValueChanged" AutoPostBack="True"
EnableViewState="True" ></asp:CheckBox>
The problem is that in ASP.NET 4.0 <%# %> server tag doesn’t maps data to control.
Of course there is a workaround to set control Text in code-behind. But i’m interesting is there a way to bind text on aspx layout?
You must call
DataBind()on the container or control itself for<%# %>to be evaluated:Data-Binding Expressions
Markup:
Code-behind: