AI OnAI Off
Do unsubscribe before subscribe :)
XFormControl.ControlSetup -= new EventHandler(XForm_ControlSetup);
XFormControl.ControlSetup += new EventHandler(XForm_ControlSetup);
Ok, Can't you subscribe to Before | After posted data events directly to CurrentBlock.Form property and not throught static ControlSetup event?
You should listen to static events only on application start, for example in Global.asax.cs as shown below:
protected void Application_Start(Object sender, EventArgs e)
{
XFormControl.ControlSetup += new EventHandler(XForm_ControlSetup);
}
Though a better practice use to be that you add listeners in an initializationmodule instead of global asax
I want to alter the form and add some functions to send mail in BeforeSubmit and in AfterSubmit I want to do a redirect to a certainpage.
How do I solve this?
In XFormBlock.ascx.cs I have the following code;
The events run fine and works. However! Everytime the page containing the xform block is rendered it will register a
which means that after entering any calendarEventPage for say 10 times and I finally post a form the BeforeSubmit event will run 10 times.
Is it possible to somehow check if the events allready been registered?