Hi,
I am trying to create ATLAS enabled Drag-Drop webparts dynamically (!) ..Webparts will be created from database. And so I've implemented custom WebpartManager, WebPart, WebPartZone, etc and I am instantiate them in OnInit() of the page. Now I have couple of problems...
1) On postback, webparts are gettind duplicated. I am pretty sure there is something to do with personalisation stored in ASPNETDB database (App_Data folder). I want to completely DISABLE the aspnetdb, because I am also authenticating users dynamically.
2) When I edit any webpart I get this exception...
System.InvalidOperationException: Should only have editor parts in the ZoneTemplate of 'editor'.
This is how I create EditZone:
EditorZone editor = new EditorZone();
editor.ID = "editor";
PropertyGridEditorPart PropertyGridEditorPart1 = new PropertyGridEditorPart();
PropertyGridEditorPart1.Title = "Web Part properties";
editor.ZoneTemplate = new ControlHolder(PropertyGridEditorPart1);
here is the code for ControlHolder class
public class ControlHolder : ITemplate {
Control ctrl = new Control();
public ControlHolder() {
ctrl.Controls.Clear();
ctrl.Controls.Add(new LiteralControl("control list is empty."));
}
public ControlHolder(Control _ctrl) {
ctrl.Controls.Clear();
if (_ctrl == null) {
ctrl.Controls.Add(new LiteralControl("control list is empty."));
}
else {
ctrl.Controls.Add(_ctrl);
}
}
void ITemplate.InstantiateIn(Control owner) {
owner.Controls.Add(ctrl);
}
}
Please help me solving above problems.
Thanks,
Haresh