Upgrades Questions on upgrading to version 6.x.
Version 6.x > Upgrades > Forms(BizForms) Event Handlers View modes: 
User avatar
Member
Member
lford-mrpricegroup - 12/14/2011 1:08:30 AM
   
Forms(BizForms) Event Handlers
I upgraded from v5.5R2 to v6 as per the documentation. The process was quite smooth, and I have found v6 to be very slick (well done Kentico!).

However, I found that my BizForms (now referred to as Forms in v6) were throwing the following exception:
[Error loading the WebPart 'BizFormMrPriceSportCompetition']
c:\inetpub\wwwroot\KenticoV6\CMSWebParts\BizForms\MrPriceSportCompetition.ascx(4): error CS0123: No overload for 'viewBiz_OnAfterValidate' matches delegate 'System.EventHandler'


The OnAtfterValidate event handler was defined as follows in my Form:
protected void viewBiz_OnAfterValidate()

From what I understand of the .NET framework, this error means that the AnAfterValidate event handler in the BizForm does not match the delegate definition of 'System.EventHandler' which is the usual (object sender, EventArgs e). I duly added the preceding code to the event handler in my BizForm and the page displayed correctly.

I have searched for any related posts, but it seems I may be the only one experiencing this issue.

So my question is this: was there an update to the event handlers of the v6 Forms which requires all custom event handlers within the Forms be updated to include the (object sender, EventArgs e) signature, or did I miss something during the upgrade process?

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 12/14/2011 5:47:47 AM
   
RE:Forms(BizForms) Event Handlers
Hello,

To register the OnAfterValidate handler you need to use the standard EventHandler class, as demonstrated here:

viewBiz.OnAfterValidate += new EventHandler(viewBiz_OnAfterValidate);


void viewBiz_OnAfterValidate(object sender, EventArgs e)
{
/// custom code
}


Regrettably, our documentation does not cover these changes yet, however we are working on an update in our documentation.

Best regards,
Boris Pocatko

User avatar
Member
Member
lford-mrpricegroup - 12/14/2011 6:57:11 AM
   
RE:Forms(BizForms) Event Handlers
Thanks Boris, that's working now.

I have since come across two other issues with Forms which I though I would share.
The first was this one:
[BasicForm.DataRow]: This property can be read only if it was previously initialized through set.
This exception was raised when running the following code in the OnBeforeSave event handler:
string FirstName = CMS.GlobalHelper.ValidationHelper.GetString(this.viewBiz.BasicForm.DataRow["FirstName"], "");

I was advised that the BasicForm.DataRow property has been replaced with the BasicForm.Data so I would need to use
IDataContainer row = this.viewBiz.BasicForm.Data;
instead of
DataRow row = this.viewBiz.BasicForm.DataRow;
With this in mind, the offending code was rewritten as follows:
using CMS.SettingsProvider;
...
IDataContainer row = this.viewBiz.BasicForm.Data;
string FirstName = ValidationHelper.GetString(row["FirstName"], String.Empty);
...

Note: You'll need to add a using CMS.SettingsProvider; to your code file in order to resolve IDataContainer.

The next issue was that the DataClass object no longer existed, but the updated code can be found in this post.

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 12/14/2011 7:34:22 AM
   
RE:Forms(BizForms) Event Handlers
Hello,

Thank you for sharing. Additional API changes from 5.5R2 to 6.0 are described in this blog post.

Best regards,
Boris Pocatko

User avatar
Member
Member
njhawar-flair-solution - 11/30/2013 2:00:54 AM
   
RE:Forms(BizForms) Event Handlers
Hello
i uses Kentico 7 and i got error on bizFoms
Message: c:\inetpub\wwwroot\njhawar\local\New folder\CMSWebParts\BizForms\GOP\bizformEmailUs.ascx(3): error CS0123: No overload for 'viewBiz_OnBeforeSave' matches delegate 'System.EventHandler'
Stack Trace:
at System.Web.Compilation.AssemblyBuilder.Compile()
at System.Web.Compilation.BuildProvidersCompiler.PerformBuild()
at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)
at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
at System.Web.UI.TemplateControl.LoadControl(VirtualPath virtualPath)
at CMS.ExtendedControls.ControlsExtensions.LoadUserControl(Page page, String controlPath)
at CMS.PortalControls.CMSWebPartZone.LoadWebPart(Control container, CMSWebPartZone zone, WebPartInstance part, Boolean reloadData, Boolean isVariant)

User avatar
Member
Member
kentico_sandroj - 11/30/2013 4:54:54 PM
   
RE:Forms(BizForms) Event Handlers
Hello,

Please re-post this question in the version 7 forums as this is a v6 section. Also, please try to include more information such as what was the last change before this issue came up, did you upgrade or is this a new install, have you customized the BizForm, etc.

Best Regards,
Sandro

User avatar
Member
Member
njhawar-flair-solution - 12/1/2013 10:24:41 PM
   
RE:Forms(BizForms) Event Handlers
i solved this problam and tnx to reply