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-
 
0 ratings
Sitemap | Content Management System | E-commerce Software | Social Networking Software | Intranet | Online Marketing Solution | Copyright © 2004-2013 Kentico Software | Powered by Kentico CMS