Code to export data to excel via  

Posted by: Quadtechindia in

if (GridView1.Rows.Count > 0)

Response.ContentType = "application/";
Response.Charset = "";
this.EnableViewState = false;

Response.Write("Add anything (tag or text) as per requirement");

GridView1.HeaderStyle.Font.Bold = true;
GridView1.HeaderStyle.BackColor = System.Drawing.Color.Black;

System.IO.StringWriter tw = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw);
HtmlForm frm = new HtmlForm();



What is Literal ?  

Posted by: Quadtechindia in

A Literal Web Server control doesn't have any visual appearance on a Web Form but is used to insert literal text into a Web Form. This control makes it possible to add HTML code directly in the code designer window without switching to design view and clicking the HTML button to edit the HTML.
The notable property of this control is the text property which is the text that is inserted into the Web Form.


The following line of code demonstrates that.

Literal1.Text = "Literal Demo"