|
-
Nov 24th, 2008, 04:34 PM
#1
Thread Starter
Not NoteMe
[2005] Designer support for template controls that include other web controls
I have developed a templated web control that has 2 templates that instanciated in controls that are in an updatepanel.
To do this i've got a private member, updatepanel, 2 private ITemplate members and 2 private container controls.
The trouble is when i want to add designer support. If i add the required designer code:
Code:
public class TemplateControlDesigner : ControlDesigner
{
TemplateGroupCollection _TemplateGroups = null;
public override string GetDesignTimeHtml()
{
return "Click here then use the top right icon to edit the templates.";
}
public override void Initialize(IComponent component)
{
base.Initialize(component);
SetViewFlags(ViewFlags.TemplateEditing, true);
}
public override TemplateGroupCollection TemplateGroups
{
get
{
if (_TemplateGroups == null)
{
_TemplateGroups = new TemplateGroupCollection();
DeferredLoading control = (DeferredLoading)Component;
TemplateGroup group;
TemplateDefinition template;
group = new TemplateGroup("Templates");
template = new TemplateDefinition(this, "Loading", control, "LoadingTemplate", true);
group.AddTemplateDefinition(template);
template = new TemplateDefinition(this, "Display", control, "DisplayTemplate", true);
group.AddTemplateDefinition(template);
TemplateGroups.Add(group);
}
return _TemplateGroups;
}
}
}
When in design mode it allows me to add controls to each of the templates, but not plain text for some reason. Also, whatever i add in design time when i switch to view the markup it's replaced whatever was there with an updatepanel (when it should be the 2 template properties).
I've tried only creating an instance of an update panel if not in design mode, however then the designer gives an object reference not set to an instance of an object.
Any ideas would be great because i'm really stuck here. I've tried searching but as i'm not really sure what to search for besides general 'how to make a templated control' i'm not getting anywhere.
Any ideas??
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe
"I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
Have I helped you? Please Rate my posts. 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|