Vulnerability in EPiServer.Forms

Try our conversational search powered by Generative AI!

Can I replace EPiServer's X-Form controls with my own?


Is there a supported way to do "control injection" on an X-Form?  I would like EPiServer to use my controls (which are derived from their controls).

I'm doing it now, but it's ugly.  I catch "ControlsCreated," and do this:

  1. Copy the Controls collection of the form into a temp array
  2. Clear the Controls collection.
  3. Check each control, and if it's one I want to replace, dynamically create one of mine, and do a deep (manual) copy of EPiServer's control state into my own (this code sucks -- I reflect, and I'm sure I'm not getting everything)
  4. Add my control back into the Controls collection.

So, essentially, I empty the Controls collection and rebuild it, swapping some of EPiServer's controls for my own.

(And, yes, I considered a Control Adapter, but some of EPiServer's methods in their X-Form controls are protected (RenderLabel, for instance), so they can't be called from the outside.  By deriving the object, I get around this.)

Any ideas?

Feb 22, 2011 0:44

I'm not sure if there is a much better way.

The code sample that exists under download also use ControlsCreated:

Mar 01, 2011 11:14
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.