Alternatives to HtmlTextWriter in a System.Web.UI.Control?
- by Marco Bettiolo
Hi,
Can you use FluentHTML or other alternatives in an web application user control?
Can you put a markup file in a System.Web.UI.Control like the System.Web.UI.UserControl but without the burden of the Page object?
I would like to reduce the number of lines of the following code:
writer.Write(SacrificalMarkupPage.GenerateControlMarkup(new DialogConfirm()));
writer.AddAttribute("class", string.Format("ajaxResponse {0}", action));
writer.RenderBeginTag("div");
writer.RenderBeginTag("h4");
writer.WriteEncodedText("Delete selected item?");
writer.RenderEndTag(); //h4
var queryString = new HttpQueryString
{
{"confirmed", "true"},
{"src", urlReferer.PathAndQuery}
};
writer.AddAttribute("href", queryString.MakeQueryString(url).PathAndQuery);
writer.AddAttribute("class", "delete");
writer.RenderBeginTag("a");
writer.WriteEncodedText("Yes");
writer.RenderEndTag(); //a.delete
writer.WriteEncodedText(" | ");
writer.AddAttribute("href", urlReferer.PathAndQuery);
writer.AddAttribute("class", "back");
writer.RenderBeginTag("a");
writer.WriteEncodedText("No");
writer.RenderEndTag(); //a.back
writer.RenderEndTag(); //div.ajaxResponse.ACTION
Thanks