【发布时间】:2015-12-16 08:55:27
【问题描述】:
请考虑以下几点:
后面的代码:
public void InitiateTable()
{
Controls.Add(new LiteralControl("<table class=\"table table-invoice\" >")); //Line that gave me error
...
Controls.Add(new LiteralControl("</table>"));
}
在我的 ASP.Net 页面上:
<% InitiateTable(); %>
当我运行代码时,它给了我一个错误提示:
The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).
谁能解释我做错了什么? 谢谢。
【问题讨论】: