Thank you very much.
I have created a cst to work with other cst, but need to learn a lot.
I am having a doubt. Whats the difference between
private CodeTemplate _mysubTemplate;
[Browsable(false)]
public CodeTemplate MySubTemplate
{
get
{
if (_mysubTemplate == null)
{
CodeTemplateCompiler compiler = new CodeTemplateCompiler("SubTemplate.cst");
compiler.Compile();
if (compiler.Errors.Count == 0)
_mysubTemplate = compiler.CreateInstance();
else
for (int i = 0; i < compiler.Errors.Count; i++)
Response.WriteLine(compiler.Errors
.ToString());
}
return _mysubTemplate;
}
}
and
<%@ Register Name="MySubTemplate" Template="SubTemplate.cst" MergeProperties="True" ExcludeProperties="IncludeMeta" %>
as these two are serving the same.......
Also I want to know whether there is any other code for OutputDirectory other than this, as i am feeling it to be very lengthy.
private string _outputDirectory = String.Empty;
[Editor(typeof(System.Windows.Forms.Design.FolderNameEditor), typeof(System.Drawing.Design.UITypeEditor))]
[CodeTemplateProperty(CodeTemplatePropertyOption.Optional)]
[Category("Context")]
[Description("The directory to output the results to.")]
[DefaultValue("")]
public string OutputDirectory
{
get
{
if (_outputDirectory.Length == 0)
{
return @"c:\NetTiers\Output";
}
else
{
return _outputDirectory;
}
}
set
{
if (value.EndsWith("\\")) value = value.Substring(0, value.Length - 1);
_outputDirectory = value;
}
}
I am using these codes in overridden Render method
mySubTemplate.Render(Response);
Response.WriteLine("Finished");
My subtemplate is executing. But i want to display "Finished" in the calling template. How to do it?
Thanks in advance