|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Convert string to ITemplateI 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 Can you provide some code to show what you're trying to do?
-- Show quoteHide quoteChristopher A. Reed "The oxen are slow, but the earth is patient." "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 > 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; } } } 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. -- Show quoteHide quoteChristopher A. Reed "The oxen are slow, but the earth is patient." "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 >
Child control designers
Making ASP.NET 2.0 asp:Wizard control fully Navigatable without mo VS2005 ASP.NET Gridview cells Defining a ControlParameter of type DateTime for a DataSource InsertItemTemplate dependant dropdown list problem Dynamic Control Positioning Treeview update on postback CheckBox in repeater asp:treeview, expand, index of node Newb...Treeview in asp |
|||||||||||||||||||||||