London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
AI OnAI Off
London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
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?