Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
AI OnAI Off
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
Don't know if this is the correct way but I'm using this approach:
public class DummyController : Controller { } public static class XhtmlStringExtensions { public static string ToParsedHtmlString(this XhtmlString xhtmlstring) { if (xhtmlstring == null || xhtmlstring.IsEmpty || string.IsNullOrWhiteSpace(xhtmlstring.ToHtmlString())) { return string.Empty; } var routeData = new RouteData(); routeData.Values.Add("controller", "a"); var hh = new HtmlHelper(new ViewContext() { HttpContext = new HttpContextWrapper(HttpContext.Current), ViewData = new ViewDataDictionary(), TempData = new TempDataDictionary(), Controller = new DummyController(), RouteData = routeData }, new ViewPage()); string result; using (var writer = new StringWriter()) { hh.ViewContext.Writer = writer; hh.RenderXhtmlString(xhtmlstring); writer.Flush(); result = writer.ToString(); } return result; } }
Hi all,
I need to get XHTML property of my block using ajax.
If I add a different block into RTE, if I call
_contentLoader.Get
I get
_contentLoader.Get
I get "".
What is the correct way of getting full correct html (including internal block html) from RTE property in ApiController?