MOSS 2007 EditModelPanel
I am writing a web control where I'm overriding the CreateChildControls method. In this method I create an EditModelPanel, add a button to it and then add the EditModePanel to my web co开发者_C百科ntrol's Controls collection (this.Controls.Add(xxx)). The problem is that the button shows up in both Display mode and Edit mode. I've tried setting EditModelPanel's PageDisplayMode property and SuppressTag property and nothing works.
Why does the EditModePanel fail when adding it programatically?
I've googled this issue and someone else had the exact same problem but he got no response.
Firstly, You can detect from within your control if you are in edit mode and not create the child controls. This way you will not need the editmodepanel.
I have refactored the editmodepanel class, and it does things a bit differently. It implements IParserAccessor and the logic is in AddParsedSubObject() method of the interface. I think by manually adding the controls, you are bypassing the IParserAccessor. Hope this helps.
精彩评论