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),那么一切都很好,并且不需要将它放在表单中。
我错过了什么?
发布于 2012-01-04 09:50:05
它不能在一个形式,但唯一知道的人是你。此异常也是防止严重错误并提供明确错误信息的一种方法。只有可以回发的控件才需要嵌套在HtmlForm控件中。
https://stackoverflow.com/questions/8724301
复制相似问题