...Technology Simplified

Wednesday, October 9, 2013

Asp.net - The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>)

No comments :
Asp.net - The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>)

I have this issue when I want to change button text in Page_init method.
This occured because I am using resource file to bind Button text.

Example:

<button class="simpleFormButton" id="btnSaveFinishButton" runat="server" type="button">
                   &lt;%=GetLocalResourceObject("SaveandFinish")%&gt;</button>

Replacing '<%=' to '<%#' solved my issue.
Hope this helps you as well.

No comments :

Post a Comment