Because I have pages with the markup <%= someVariable%> like
<script type="text/javascript"> function ConfirmCallBack(arg) { if (arg) <%= this._nextPostBack%> }
</script>
I get the following error: "The Controls collection cannot be modified because the control contains code blocks (i.e. <% … %><% … %>)."
To correct it I had to change from
<%= this._nextPostBack%>
to
<%# this._nextPostBack%>
and in the PageLoad event add the call to Page’s DataBind method
protected void Page_Load(object sender, EventArgs e) {
...
Page.DataBind(); }