protected internal void HtmlRender(HtmlTextWriter writer)
{
StringBuilder sb = new StringBuilder(256);
base.Render(new HtmlTextWriter(new StringWriter(sb)));
string html = sb.ToString().Trim();
html = html.Replace("display:inline-block;", "");
html = html.Replace(" style=\"\"", "");
//html = Regex.Replace(html, "<div:layout id=\"[^\"]+\"[^<]*>|</div:layout>", "", RegexOptions.IgnoreCase);
html = Div_Layout_RE.Replace(html, "");
if (!this.HasContent())
{
//html = Regex.Replace(html, "<div:body id=\"[^\"]+_Content\"[^<]*>|</div:body>", "", RegexOptions.IgnoreCase);
html = Div_Body_RE.Replace(html, "");
}
if ( this.IsLazy
|| (this.TopDynamicControl && this.ContentUpdated)
|| this.IsDynamicLazy
|| (this.RemoveContainer && !RequestManager.IsMicrosoftAjaxRequest))
{
//html = Regex.Replace(html, "<div:container id=\"[^\"]+\"[^<]*>|</div:container>", "", RegexOptions.IgnoreCase); ;
html = Div_Container_RE.Replace(html, ""); ;
}
// html = Regex.Replace(html, "div:container|div:body", "div", RegexOptions.IgnoreCase)
// .Replace("id=\"{0}\"".FormatWith(this.ClientID), "id=\"{0}\"".FormatWith(this.ContainerID));
html = Div_ContainerBody_RE.Replace(html, "div")
.Replace("id=\"{0}\"".FormatWith(this.ClientID), "id=\"{0}\"".FormatWith(this.ContainerID));
if (this.TopDynamicControl && html.IsNotEmpty() && (RequestManager.IsAjaxRequest || this.Page is ISelfRenderingPage))
{
//html = Regex.Replace(html, "<Ext.Net.Direct.Response>.*</Ext.Net.Direct.Response>", "");
html = DirectResponse_RE.Replace(html, "");
html = InitScriptWarning_RE.Replace(html, "");
int start = html.IndexOf(InitScriptFilter.OPEN_SCRIPT_TAG);
if (start >= 0)
{
int end = html.IndexOf(InitScriptFilter.CLOSE_SCRIPT_TAG) + InitScriptFilter.CLOSE_SCRIPT_TAG.Length;
html = html.Remove(start, end - start);
}
string[] lines = html.Split(new string[] { "\r\n", "\n", "\r", "\t" }, StringSplitOptions.RemoveEmptyEntries);
if (lines.Length == 0)
{
return;
}
html = JSON.Serialize(lines).ConcatWith(".join('')");
html = html.Replace("</script>", "<\\/script>");
string domParent = "";
if (this is Component)
{
domParent = ((Component)this).RenderToProxy;
if (domParent.IsNotEmpty())
{
domParent = string.Concat("Ext.net.getEl(", this.ParseDomParent(domParent), ")");
}
}
if (domParent.IsEmpty())
{
if (this.Page != null && this.Page.Form != null)
{
domParent = "Ext.get('".ConcatWith(this.Page.Form.ClientID, "')");
}
else
{
domParent = "Ext.getBody()";
}
}
if (this.ContentUpdated && this is IContent)
{
sb.AppendFormat("{3}Ext.net.replaceContent({0},{1},{2});{4}", this.ClientID, JSON.Serialize(((IContent)this).ContentEl), html, XControl.TOP_DYNAMIC_CONTROL_TAG_S, XControl.TOP_DYNAMIC_CONTROL_TAG_E);
}
else
{
sb.AppendFormat("{2}Ext.net.append({0},{1});{3}", domParent, html, XControl.TOP_DYNAMIC_CONTROL_TAG_S, XControl.TOP_DYNAMIC_CONTROL_TAG_E);
}
writer.Write(sb.ToString());
}
else
{
writer.Write(html);
}
}