In special cases you may need to generate html code and provide it as a web service. The example shows how to create a repeater control dynamically, configure its properties and return html code.
[WebMethod]
public static string GetDate()
{
Page pageHolder = new Page();
CMSRepeater rep = (CMSRepeater)pageHolder.LoadControl(typeof(CMSRepeater), null);
rep.ClassNames = "cms.article";
rep.Path = ".";
rep.TransformationName = "cms.article.default";
pageHolder.Controls.Add(rep);
StringWriter output = new StringWriter();
HttpContext.Current.Server.Execute(pageHolder, output, false);
return output.ToString();
}
-it-