Portal Engine Questions on portal engine and web parts.
Version 4.x > Portal Engine > Modifying Bizform web part View modes: 
User avatar
Member
Member
matt-4hilton - 12/19/2010 11:23:46 AM
   
Modifying Bizform web part
Hi all,

I've been racking my brain all day about this problem, and I simply can't figure it out. Let me explain:

I'm using a cloned version of the Bizform web part, called neighborhoodChecker. It therefore now has two files under the CMSWebParts directory: Shukishuk_neighborhoodChecker.ascx, and Shukishuk_neighborhoodChecker.ascx.cs

In the design of the web part, I simply added a dropdown box which is populated by a custom table above the cms:BizForm.

In the cms:Bizform tag (the BizForm Control), I added ononafterdataload="viewBiz_OnAfterDataLoad" (viewBiz is the ID for my BizForm control) The reason for this is because after the BizForm is loaded, I check the value of the dropdown, and if it's equal to "Other", I set the Bizform's visibility to false.

The problem is, for some inexplicable reason, viewBiz_OnAfterDataLoad never gets called.

Could somebody please tell me how (or rather, with what function) I can access viewBiz.BasicForm.FieldControls in my Shukishuk_neighborhoodChecker.ascx.cs without getting an error, if not in the onAfterDataLoad function?

One more thing. The BizForm (viewBiz) does get loaded, somewhere, as it appears on the web page. But I simply can't figure out how it gets loaded, and how I can access its field controls after it's loaded.

Thank you.

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 12/20/2010 4:59:09 AM
   
RE:Modifying Bizform web part
Hi,

to change visibility of bizform when the "Other" option is selected in the dropdown list you can use for example following code.

- add a dropdown list ascx page:

<asp:DropDownList ID="DropDownList1" runat="server" OnSelectedIndexChanged="changed" AutoPostBack="true">
<asp:ListItem Value="TestData1">TestDataA</asp:ListItem>
<asp:ListItem Value="Other">Do not display Biz form</asp:ListItem>
</asp:DropDownList>


- add method changed() in the code behind:

  
public void changed(Object sender, EventArgs e)
{
base.ReloadData();
SetupControl();
}


- modify else part of SetupControl() method

else
{
// change visibility if Other option is selected
if (DropDownList1.SelectedValue == "Other")
{
viewBiz.Visible=false;
}

// Set BizForm properties
viewBiz.FormName = this.BizFormName;
viewBiz.SiteName = this.SiteName;
viewBiz.UseColonBehindLabel = this.UseColonBehindLabel;
viewBiz.AlternativeFormFullName = this.AlternativeFormName;
viewBiz.ValidationErrorMessage = this.ValidationErrorMessage;

// Set the live site context
if (viewBiz.BasicForm != null)
{
viewBiz.BasicForm.ControlContext.ContextName = CMS.SiteProvider.ControlContext.LIVE_SITE;
}
}



Best regards,
Ivana Tomanickova