How to use/call bizform generated code in mvc controller and view

Divya B asked on May 21, 2019 13:39

Hi all,

I had created one bizform on admin side with the name of contactBiz. I need it to display in front end / UI side to display. How can i do that.

Recent Answers


Dmitry Bastron answered on May 21, 2019 14:30

Hi Divya,

Kentico has out-of-the-box Form widget, please refer to the documentation. It allows also some kind of customization described here.

But if you want to display the form in your own code (your controller + view) I'm afraid you would need to decompile and check how Kentico's standard Forms widget works and reproduce the same approach. This is as per my knowledge.

0 votesVote for this answer Mark as a Correct answer

Mike Wills answered on May 21, 2019 17:29

Hi Divya,

You can get the list of field and field groups defined for a form by using the BizFormInfoProvider and reading the ItemsList. It contains the list of fields and field groups defined for the form. Some of the field attributes are defined as properties of the FormFieldInfo object, while others are in hashtables provided by FormFieldInfo.Settings and FormFieldInfo.Properties.

var bizFormInfo = BizFormInfoProvider.GetBizFormInfo("Mike_sSample", "DancingGoat");
var itemsList = bizFormInfo.Form.ItemsList;

To submit form data, get the BizFormInfo object again, and then use the FormClassID to get the DataClassInfo object. You can then call BizFormItem.New to create a new form data record. Here's a simple sample without any field validation checks.

var classInfo = DataClassInfoProvider.GetDataClassInfo(formClassID);
var formItem = BizFormItem.New(classInfo.ClassName);

// Set field values using formItem.SetValue
formItem.Insert();

Take care,

Mike

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.