Follow @harshit_parshii HtmlTextWriter:- The HtmlTextWriter class is used to render HTML 4.0 to desktop browsers. The HtmlTextWriter is also the base class for all markup writers in theSystem.Web.UI namespace. It Writes markup characters and text to an ASP.NET server control output stream. This class provides formatting capabilities that ASP.NET server controls use when rendering markup to clients. It allows you to generate a list of HTML elements, such as <div> elements. You could use StringBuilder to create the HTML, but HtmlTextWriter is sometimes better—fewer errors are likely. Below is sample code: protected void Page_Load(object sender, EventArgs e) { TextBox txtBox = new TextBox(); // Initialize StringWriter instance. StringWriter stringWriter = new StringWriter(); // Put HtmlTextWriter in using block because it needs to call Dispose. using(HtmlTextWriter writer ...
A blog about software and web app learning/coding, revolving around .net, JavaScript, sql, html, css and whatever technical I found in this beautiful world.