Can InfoPath forms have multiple code-behind files?
-
09-12-2019 - |
Question
I've recently been doing support work for few solutions built with browser-based InfoPath forms. And all of the solutions have had a large amount of customization using code-behind.
So far I've only seen one code-behind file (FormCode.cs) used for each form. Is it possible to organize (re-organize in my case) the code into multiple files?
Solution
A bit late, but since the other answer was not terribly helpful, you can reference other classes and code in a separate strong-named assembly and include a reference to it in your project. The form's assembly may be fairly rigid, but you can always design around it. Build your other functions/classes in a separate VS project, deploy it as a SP solution, and then target your form against that.
OTHER TIPS
The FormCode class is a partial
class
. You can add multiple code-files to organize so long as they are partial FormCode classes as well (edited per first comment).
It is possible to have embedded classes under FormCode also.