Add usercontrol to page in page init from text reference
Posted on 2011-03-09
Hello, I have a text editor control where users can create a page then add text, video, images and other things. I want to also allow them to add usercontrols that I create to where they place the control in the text editor. Basically, I add to the text editor's content a discriptive tag such as ***mycontrol*** when they drop the control into the editor(perhaps into a div or table).
I have created some controls and have registered them in the web.config.
Now, when the page init fires I get the page and parse for the discriptive tag ***mycontrol*** . I remove the tag and add the html for a placeholder control. The place holder is given a name when created like phMyControl.
On page load I want to find the placehoder control that was created in the page init and do control.add to add the ***mycontrol***
I can't seem to find the placeholder control using findcontrol!
My questions are:
Is it possible to do what I'm trying to do?
Is my approach the best way to do this?
Why can't I find the programatically added placeholder control so I can add the usercontrol to the page?
Is there a better way? How does DNN do it?