Home All Groups Group Topic Archive Search About
Author
8 Feb 2006 11:45 AM
Allan Ebdrup
I have a templated control, now I wnat to set the template to be a string,
BUt I cant assign a string to my ITemplate property.
How do I get my string converted to an ITemplate?

Kind Regards,
Allan Ebdrup

Author
8 Feb 2006 12:35 PM
Christopher Reed
Can you provide some code to show what you're trying to do?
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."

Show quoteHide quote
"Allan Ebdrup" <ebdrup@noemail.noemail> wrote in message
news:OZ4k0UKLGHA.2904@TK2MSFTNGP10.phx.gbl...
>I have a templated control, now I wnat to set the template to be a string,
>BUt I cant assign a string to my ITemplate property.
> How do I get my string converted to an ITemplate?
>
> Kind Regards,
> Allan Ebdrup
>
Author
8 Feb 2006 3:20 PM
Allan Ebdrup
I found this example that helped
http://msdn2.microsoft.com/system.web.ui.design.editabledesignerregion.aspx
Take a look at the SetEditableDesignerRegionContent method:
        public override void
SetEditableDesignerRegionContent(EditableDesignerRegion region, string
content)
        {
            if (content == null)
                return;

            // Get a reference to the designer host
            IDesignerHost host =
(IDesignerHost)Component.Site.GetService(typeof(IDesignerHost));
            if (host != null)
            {
                // Create a template from the content string
                ITemplate template = ControlParser.ParseTemplate(host,
content);

                if (template != null)
                {
                    // Determine which region should get the template
                    // Either 'Content0' or 'Content1'
                    if (region.Name.EndsWith("0"))
                        myControl.View1 = template;
                    else if (region.Name.EndsWith("1"))
                        myControl.View2 = template;
                }
            }
        }
Author
9 Feb 2006 12:34 PM
Christopher Reed
I guess the next question is why do you want the template to be only a
string?  Additionally, do you want to edit the template with controls and
other things?  I do not believe that the template area will allow controls
if you force the existance of only a string.
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."

Show quoteHide quote
"Allan Ebdrup" <ebdrup@noemail.noemail> wrote in message
news:OZ4k0UKLGHA.2904@TK2MSFTNGP10.phx.gbl...
>I have a templated control, now I wnat to set the template to be a string,
>BUt I cant assign a string to my ITemplate property.
> How do I get my string converted to an ITemplate?
>
> Kind Regards,
> Allan Ebdrup
>