Kentico 11. Insert value into Bizform input field dynamically

Tom Wisneski asked on April 6, 2020 23:00

Question - in Code behind (weforms). What is the way you can place text in bizform field. I have tried, bizform.FieldControls["fieldname"].Value = "some text", and also bizform.FieldControls["fieldname"].Text= "some text" These do not error out, but neither does it work. Thanks.

Correct Answer

Brenden Kehren answered on April 6, 2020 23:30

Then I'd create a global event handler so you can simply use the base webpart or control for this (even if it is MVC). This way you have one place to manage it. This post has code for v7 but it's similar in nature. Just use the new global event handler (in links below) and place the event code inside of it.

BizForm Global Events
Global Event Hanlder

0 votesVote for this answer Unmark Correct answer

Recent Answers


Brenden Kehren answered on April 6, 2020 23:20

Are you setting this on first load or what data are you setting it to? You can typically do this on the form field's default value when you create the form with a macro. In the default value field, create your macro to fill in the space. For instance, in the FirstName field, you could use something like {%MembershipContext.AuthenticatedUser.FirstName%}

0 votesVote for this answer Mark as a Correct answer

Tom Wisneski answered on April 6, 2020 23:23

Brenden, thanks for the reply. No, this will be set in a code behind file, prior to the save. So in the OnBeforeSave method.

0 votesVote for this answer Mark as a Correct answer

Tom Wisneski answered on April 6, 2020 23:35

Brenden...why did it work in a previous version with "viewBiz" rather then "bizform". This had worked in the past; viewBiz.Data.SetValue("CountryState", "Australia"); Now however when trying it with 'bizform' it fails?

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on April 6, 2020 23:38

Not sure but with API changes I'm guessing it broke. Plus that way really isn't recommended because it limits that web part to one specific bizform which is not ideal at all.

0 votesVote for this answer Mark as a Correct answer

Tom Wisneski answered on April 6, 2020 23:41

Thanks for the input...it is appreciated.

0 votesVote for this answer Mark as a Correct answer

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