关于VerifyRenderingInServerForm()事件 [英] about VerifyRenderingInServerForm() event

查看:67
本文介绍了关于VerifyRenderingInServerForm()事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



GOOd早上!!!





当时'VerifyRenderingInServerForm()'事件被调用?





请详细告诉我这个...





感谢Adv。

Hello ALL,

GOOd Morning!!!


at which time 'VerifyRenderingInServerForm()' event called?


Please teel me about that in detail ..


Thanks in Adv.

推荐答案

您好 Page.VerifyRenderingInServerForm() 不是一个事件,而是一个方法。它确保在运行时为指定的ASP.NET服务器控件呈现任何HtmlForm控件。需要在< form runat = server> 标记内的控件可以在渲染之前调用此方法,以便在它们放置在标记之外时显示错误消息。回发或依赖于已注册的脚本块的控件应该在Control.Render方法的覆盖中调用此方法。具有不同呈现服务器表单元素的方式的页面可以覆盖此方法以在不同条件下抛出异常。



,如http://msdn.microsoft.com/en-us/library/system.web.ui.page .verifyrenderinginserverform.aspx [ ^ ]



Hi Page.VerifyRenderingInServerForm() is not an event but rather a method. It makes sure that any HtmlForm control is rendered for the specified ASP.NET server control at run time. Controls that are required to be inside <form runat=server> tags can call this method before they render so that an error message is shown if they are placed outside the tags. Controls that post back or depend on registered script blocks should call this method in an override of the Control.Render method. Pages that have a different way of rendering the server form element can override this method to throw an exception under different conditions.

as stated in http://msdn.microsoft.com/en-us/library/system.web.ui.page.verifyrenderinginserverform.aspx[^]

// Override the Render method to ensure that this control
// is nested in an HtmlForm server control, between a <form runat=server>
// opening tag and a </form> closing tag.
protected override void Render(HtmlTextWriter writer) {
    // Ensure that the control is nested in a server form.
    if (Page != null) {
        Page.VerifyRenderingInServerForm(this);
    }
    base.Render(writer);
}


// Summary:
        //     Confirms that an System.Web.UI.HtmlControls.HtmlForm control is rendered
        //     for the specified ASP.NET server control at run time.
        //
        // Parameters:
        //   control:
        //     The ASP.NET server control that is required in the System.Web.UI.HtmlControls.HtmlForm
        //     control.
        //
        // Exceptions:
        //   System.Web.HttpException:
        //     The specified server control is not contained between the opening and closing
        //     tags of the System.Web.UI.HtmlControls.HtmlForm server control at run time.
        //
        //   System.ArgumentNullException:
        //     The control to verify is null.


这篇关于关于VerifyRenderingInServerForm()事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆