Click here to Skip to main content
15,897,187 members
Please Sign up or sign in to vote.
1.60/5 (2 votes)
Tell compiler that the control is rendered explicitly by overriding the VerifyRenderingInServerForm event.



public override void VerifyRenderingInServerForm(Control control)
{
    /* Verifies that the control is rendered */
}


Does someone now how to use this code?

when adding this i get this error
C#
Error	2	'Cv.Knowit.GenerateCv.GenerateCvUserControl.VerifyRenderingInServerForm(System.Web.UI.Control)': no suitable method found to override	C:\Users\Administrator\Documents\Visual Studio 2010\Projects\Cv.Knowit\Cv.Knowit\GenerateCv\GenerateCvUserControl.ascx.cs	1350	30	Cv.Knowit


I found this code also

C#
// 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);
}


How should i use it ?

Now i found out that if i put public partial class GenerateCvUserControl : System.Web.UI.Page
It works but now i get the error
VB
Line 8:  <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="GenerateCvUserControl.ascx.cs" Inherits="Cv.Knowit.GenerateCv.GenerateCvUserControl" %>


Because before it was like this
public partial class GenerateCvUserControl : UserControl
Posted
Updated 20-Apr-13 8:52am
v4

1 solution

On the line below

C#
Line 8:  <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="GenerateCvUserControl.ascx.cs" Inherits="Cv.Knowit.GenerateCv.GenerateCvUserControl" %>


Add the attribute
C#
EnableEventValidation="false"
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900