ASPX templates
Version 5.x > ASPX templates > Using Custom BizForm with ASPX Template View modes: 
User avatar
Member
Member
maker.plays.ten-gmail - 6/23/2011 10:06:03 AM
   
Using Custom BizForm with ASPX Template
I think there may be a gap in my understanding of webparts.

Here is the scenario: there are two sites, "PortalSite" (uses Portal templates) and ("AspxSite" uses ASPX) templates. The basic BizForm webpart has been cloned to add custom functionality. An instance of this CustomBizForm has been initialized on the "PortalSite" and several alternate layouts have been created. These alternate layouts are displaying properly on "PortalSite" templates. For reference:

Sites:
- "PortalSite"
- "AspxSite"

Custom WebParts:
- "CustomBizForm" ("~/CMSWebParts/ClientFolder/BizForm.ascx"; registered in Kentico installation as a WebPart)

WebPart Instances:
- "CustomBizFormInstance" (setup on "PortalSite")



I want to display this CustomBizForm on the "AspxSite". As I understand it, the following code should work

..
<%@ Register Assembly="CMS.PortalControls" Namespace="CMS.PortalControls" TagPrefix="cc2" %>
<%@ Register Assembly="CMS.Controls" Namespace="CMS.Controls" TagPrefix="cms" %>
<%@ Register Src="~/CMSWebParts/ClientFolder/BizForm.ascx" TagName="CustomBizFormWebPart" TagPrefix="uc1" %>
..
<uc1:CustomBizFormWebPart ID="CustomBizFormID"
AlternativeFormFullName="CustomBizForm.CustomBizFormInstance.CustomBizFormInstanceAlternate"
UseColonBehindLabel="false"
runat="server"
FormName="CustomBizFormInstance"
SiteName="PortalSite"
Visible="true" />
..

The page renders without exception, but the CustomBizForm is not displayed (just an empty HTML tag representing the control). I also tried the following using Kentico's default BizForm webpart:

..
<%@ Register Assembly="CMS.PortalControls" Namespace="CMS.PortalControls" TagPrefix="cc2" %>
<%@ Register Assembly="CMS.Controls" Namespace="CMS.Controls" TagPrefix="cms" %>
<%@ Register Src="~/CMSWebParts/bizforms/bizform.ascx" TagName="BizFormWebPart" TagPrefix="uc1" %>
..
<uc1:BizFormWebPart ID="CustomBizFormID"
AlternativeFormFullName="BizForm.CustomBizFormInstance.CustomBizFormInstanceAlternate"
UseColonBehindLabel="false"
runat="server"
FormName="CustomBizFormInstance"
SiteName="PortalSite"
Visible="true" />
..

Same Result. The following allows the BizForm to render on the page, but does not include the custom functionality (it uses the <cms:BizForm/> tag).

..
<%@ Register Assembly="CMS.PortalControls" Namespace="CMS.PortalControls" TagPrefix="cc2" %>
<%@ Register Assembly="CMS.Controls" Namespace="CMS.Controls" TagPrefix="cms" %>
..
<cms:BizForm ID="CustomBizFormID"
AlternativeFormFullName="BizForm.CustomBizFormInstance.CustomBizFormInstanceAlternate"
UseColonBehindLabel="false"
runat="server"
FormName="CustomBizFormInstance"
SiteName="PortalSite"
Visible="true" />
..


What am I missing?

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 6/24/2011 12:51:20 AM
   
RE:Using Custom BizForm with ASPX Template
Hello,

I would recommend you to check our sample sites in future where are nearly all web parts used in the Examples section. The BizForm is used the following way:

<cms:WebPartContainer ID="wpcpageplaceholder" runat="server" ContainerName="Padding.Content">
<cms:BizForm runat="server" ID="BizForm" FormName="ContactUsASPXForm" EnableViewState="false" />
</cms:WebPartContainer>

Could you please try to use a similar setup to see if it works for you?

Best regards,
Boris Pocatko

User avatar
Member
Member
maker.plays.ten-gmail - 6/24/2011 12:43:12 PM
   
RE:Using Custom BizForm with ASPX Template
Hi Boris,

Thank-you for responding. The issue has been resolved. The solution was to use slightly different attributes, with slightly different values:

..
<%@ Register Assembly="CMS.Controls" Namespace="CMS.Controls" TagPrefix="cms" %>
<%@ Register Src="~/CMSWebParts/ClientFolder/BizForm.ascx" TagName="CustomBizFormWebPart" TagPrefix="uc1" %>
..
<uc1:CustomBizFormWebPart ID="CustomBizFormID"
SiteName="PortalSite"
BizFormName="CustomBizFormInstance"
AlternativeFormName="BizForm.CustomBizFormInstance.CustomBizFormInstanceAlternate"
UseColonBehindLabel="false"
Visible="true"
runat="server" />
..

The format for the AlternativeFormName attribute is:
ClassName.BizFormName.AlternativeLayoutName

The documentation describe it as:
ClassName.AlternativeFormName

Which is a bit ambiguous, since the "AlternativeFormName" implies both the root "BizFormName" and the "AlternativeLayoutName". Also, the "ClassName" for any webpart that clones the original "BizForm" webpart is "BizForm". The ClassName never changes. If I had looked more closely at the webpart instance attributes in the portal site I would have seen this :P .

Thanks again for the quick reply.

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 6/28/2011 2:22:21 AM
   
RE:Using Custom BizForm with ASPX Template
Hello,

Thank you for pointing this out. I've submitted a requirement to update the documentation on this case.
EDIT: Could you please let me know to which documentation you are refering to? We weren't able to find it.

Best regards,
Boris Pocatko