解決 The Controls collection cannot be modified because the control contains code blocks
來源:懂視網
責編:小采
時間:2020-11-27 22:43:03
解決 The Controls collection cannot be modified because the control contains code blocks
解決 The Controls collection cannot be modified because the control contains code blocks:在.aspx或.ascx的如果包括<%= %>,并在.aspx, .ascs中使用了AjaxToolkit中的控件,那么很可能會引發The Controls collection cannot be modified because the control contains code blocks 異常, 解決辦法
導讀解決 The Controls collection cannot be modified because the control contains code blocks:在.aspx或.ascx的如果包括<%= %>,并在.aspx, .ascs中使用了AjaxToolkit中的控件,那么很可能會引發The Controls collection cannot be modified because the control contains code blocks 異常, 解決辦法

在.aspx或.ascx的如果包括<%= %>,并在.aspx, .ascs中使用了AjaxToolkit中的控件,那么很可能會引發"The Controls collection cannot be modified because the control contains code blocks" 異常,
解決辦法如下
1. 將<%= 換為<%#
2. 在.asp或模板頁中的Page_Load事件中添加如下代碼
代碼如下:
Page.Header.DataBind();
聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com
解決 The Controls collection cannot be modified because the control contains code blocks
解決 The Controls collection cannot be modified because the control contains code blocks:在.aspx或.ascx的如果包括<%= %>,并在.aspx, .ascs中使用了AjaxToolkit中的控件,那么很可能會引發The Controls collection cannot be modified because the control contains code blocks 異常, 解決辦法