Hi,
I'm experiencing a problem with XForms on one project that I've not had before. The ControlsCreated event is firing as expected but for some reason, despite the page being valid, the AfterSubmitPostedData event is not firing. The code for setting up the event is below.
Has anyone ever experienced this before?
Thanks,
Justin
private void Page_Init(object sender, System.EventArgs e)
{
if (CurrentPage.Property["MainXForm"].IsNull)
{
return;
}
SetupForm();
FormControl.FormDefinition = Form;
FormControl.BeforeReadingPostedData += new SaveFormDataEventHandler(FormControl_BeforeReadingPostedData);
FormControl.BeforeSubmitPostedData += new SaveFormDataEventHandler(FormControl_BeforeSubmitPostedData);
FormControl.AfterSubmitPostedData += new SaveFormDataEventHandler(FormControl_AfterSubmitPostedData);
FormControl.ControlsCreated += new EventHandler(FormControl_ControlsCreated);
}
Hi Justin,
I had the same problem. My solution was the move code for setting up the form event to the OnInit method. Your code should look something like this:
private void Page_OnInitEventArgs e)
{
base.OnInit(e);
if (CurrentPage.Property["MainXForm"].IsNull)
{
return;
}
SetupForm();
FormControl.FormDefinition = Form;
FormControl.BeforeReadingPostedData += new SaveFormDataEventHandler(FormControl_BeforeReadingPostedData);
FormControl.BeforeSubmitPostedData += new SaveFormDataEventHandler(FormControl_BeforeSubmitPostedData);
FormControl.AfterSubmitPostedData += new SaveFormDataEventHandler(FormControl_AfterSubmitPostedData);
FormControl.ControlsCreated += new EventHandler(FormControl_ControlsCreated);
}
I hope this helps you solve your problem.
Best Regards,
Christian
I got this problem, but it only appeared if the page to show after posting was set. If it was set, for some reason the AfterSubmitPostedData event did not fire.
private void Page_Init(object sender, System.EventArgs e) { if (CurrentPage.Property["MainXForm"].IsNull) { return; } SetupForm(); FormControl.FormDefinition = Form; FormControl.BeforeReadingPostedData += new SaveFormDataEventHandler(FormControl_BeforeReadingPostedData); FormControl.BeforeSubmitPostedData += new SaveFormDataEventHandler(FormControl_BeforeSubmitPostedData); FormControl.AfterSubmitPostedData += new SaveFormDataEventHandler(FormControl_AfterSubmitPostedData); FormControl.ControlsCreated += new EventHandler(FormControl_ControlsCreated); }