Is there any way to create and render a subtemplate from a code behind file?
Thanks.
Hello,
Yes, this is possible, but i would recommend not creating the physical template in a code behind. Please watch the following video.Thanks-Blake Niemyjski
Blake Niemyjski CodeSmith Tools, LLC. Software Development Engineer Blog: http://windowscoding.com/blogs/blake/ .NetTiers team | Visit http://www.nettiers.com
I have created an base class and the inheriting objects need to override certain methods which render different subtemplates depending on the object type.
The subtemplate name in the register tag is found when used in a runat="template" script but the code behind file doesn't see it. How can I a register the subtemplate from a code behind?
Could you send me your samples and I'll take a look at it. I've done some updates in CodeSmith 5.0.4 to make this possible theoretically but I'm not sure that it is still 100% supported...Thanks-Blake Niemyjski
Hello, Could you send me your samples and I'll take a look at it. I've done some updates in CodeSmith 5.0.4 to make this possible theoretically but I'm not sure that it is still 100% supported...Thanks -Blake Niemyjski
Could you send me your samples and I'll take a look at it. I've done some updates in CodeSmith 5.0.4 to make this possible theoretically but I'm not sure that it is still 100% supported...Thanks -Blake Niemyjski
Thanks, I'l take a look at this.
P.S I'll be out later today and part of tomorrow. Thanks-Blake Niemyjski
I don't know why you have your code behind setup like that.. I think that your virtual methods should be in animal template and your cat and dog templates should do the work...
Thanks-Blake Niemyjski
Hello, I don't know why you have your code behind setup like that.. I think that your virtual methods should be in animal template and your cat and dog templates should do the work... Thanks-Blake Niemyjski
"How can I create a subtemplate from a code-behind file? See GenerateAnimal procedure."
I would create three seperate templates and reference an assembly that has a class that inheirts sqlcodetemplate call this AnimalTemplate. Then have your virutal method in that. And then in your logic create the correct template based on what the user selected as a property... There is no reason why you need a helper class do to accomplish this.
Hello, "How can I create a subtemplate from a code-behind file? See GenerateAnimal procedure." I would create three seperate templates and reference an assembly that has a class that inheirts sqlcodetemplate call this AnimalTemplate. Then have your virutal method in that. And then in your logic create the correct template based on what the user selected as a property... There is no reason why you need a helper class do to accomplish this. Thanks-Blake Niemyjski
MyTemplate t = this.Create<MyTemplate>(); t.Render(Response);
That should be no problem. The problem is what your passing into Render() and how your dynamically switching inheirited templates. This should be done by control structures instead of helper classes.
Hello, MyTemplate t = this.Create<MyTemplate>(); t.Render(Response); That should be no problem. The problem is what your passing into Render() and how your dynamically switching inheirited templates. This should be done by control structures instead of helper classes. Thanks-Blake Niemyjski
Can you send me your updated templates.Thank you,Blake Niemyjski
Hello, Can you send me your updated templates.Thank you,Blake Niemyjski