ASP.NET
A.aspx
我正在使用 JQuery 访问加载包含 GridView 的控件( ascx )的 ashx 文件。控件内容正在被注入页面...
当我这样做时:
StringWriter writer = new StringWriter();
HttpContext.Current.Server.Execute(page, writer, false);
string output = writer.ToString();
它告诉我 GridView 必须放在表单部分中。
所以我创建了我的页面
public class MyPage: Page
{
public override void VerifyRenderingInServerForm(Control control)
{
//base.VerifyRenderingInServerForm(control);
}
}
在其中我覆盖了这个方法。我正在使用我的页面,一切都很好。
问题是为什么?为什么它必须是一种形式?它没有任何输入!
另外,如果我的 ascx 只包含<asp:Label ( runatServer)
一切都很好,并且不需要将它放在表单中。
我错过了什么?