public static HtmlBlock BeginScriptBlock(this WebViewPage page) { if (page == null) { throw new ArgumentNullException("page"); } var block = new HtmlBlock(page); return(block); }
public static IHtmlString RenderRegisteredScripts(this WebViewPage page) { if (page == null) { throw new ArgumentNullException("page"); } var context = page.Context; var registeredScripts = (context.Items[_UniqueId] as IList <string>) ?? new List <string>(0); var scriptBlocks = HtmlBlock.GetRegisteredScriptBlocks(context) ?? new List <string>(0); var sb = new StringBuilder(); foreach (var script in registeredScripts) { sb.AppendLine(script); } foreach (var script in scriptBlocks) { sb.AppendLine(script); } return(new HtmlString(sb.ToString())); }