<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1603683968943160062</id><updated>2024-08-28T08:39:42.884-07:00</updated><title type='text'>Hirpara Jigs Blogs</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://jigneshhirpara.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1603683968943160062/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://jigneshhirpara.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Aspnet Blog</name><uri>http://www.blogger.com/profile/05026124318899904261</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='18' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjg8fG_htl_Ycu9RwdVNDUTFEN4pj2vQC5JIVWSSkzwEUWHtI_zAKWEX8AHcLhQYpVyCv_t7MzDw7CoNI1NBlagrrwvsinnwLe_a8wF8ZoTE0pNkfO1pytRog4b9RGpS_M/s220/226273_147861055282808_100001767425850_294367_7136963_n.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>14</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1603683968943160062.post-464202698448374584</id><published>2017-01-17T21:13:00.001-08:00</published><updated>2017-01-17T21:17:33.513-08:00</updated><title type='text'>Difference between Singleton Class and Static Class</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span id=&quot;ctl00_ContentMain_LabelBlogDetail&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;b&gt;Static Class:&lt;/b&gt;&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;You cannot create the instance of static class.&lt;br /&gt;&lt;br /&gt; &lt;/li&gt;
&lt;li&gt;Loaded
 automatically by the .NET Framework common language runtime (CLR)   
when the program or namespace containing the class is loaded.&lt;br /&gt;&lt;/li&gt;
&lt;li&gt;We cannot inherit Static class to another Static class in C#.&lt;br /&gt;&lt;/li&gt;
&lt;li&gt;We cannot pass the static class to method.&lt;br /&gt; &lt;/li&gt;
&lt;/ol&gt;
&lt;b&gt;Singleton:&lt;/b&gt;&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;You can create one instance of the object and reuse it.&lt;br /&gt;&lt;br /&gt; &lt;/li&gt;
&lt;li&gt;Singleton instance is created for the first time when the user   requested. &lt;br /&gt;&lt;br /&gt; &lt;/li&gt;
&lt;li&gt;Singleton class can have constructor.&lt;br /&gt;&lt;br /&gt; &lt;/li&gt;
&lt;li&gt;You can create the object of singleton class and pass it to method.&lt;br /&gt;&lt;br /&gt; &lt;/li&gt;
&lt;li&gt;We can dispose the objects of a singleton class but not of static class.&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://jigneshhirpara.blogspot.com/feeds/464202698448374584/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jigneshhirpara.blogspot.com/2017/01/difference-between-singleton-class-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1603683968943160062/posts/default/464202698448374584'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1603683968943160062/posts/default/464202698448374584'/><link rel='alternate' type='text/html' href='http://jigneshhirpara.blogspot.com/2017/01/difference-between-singleton-class-and.html' title='Difference between Singleton Class and Static Class'/><author><name>Aspnet Blog</name><uri>http://www.blogger.com/profile/05026124318899904261</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='18' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjg8fG_htl_Ycu9RwdVNDUTFEN4pj2vQC5JIVWSSkzwEUWHtI_zAKWEX8AHcLhQYpVyCv_t7MzDw7CoNI1NBlagrrwvsinnwLe_a8wF8ZoTE0pNkfO1pytRog4b9RGpS_M/s220/226273_147861055282808_100001767425850_294367_7136963_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1603683968943160062.post-3197376056027202516</id><published>2016-12-07T03:19:00.001-08:00</published><updated>2016-12-07T03:19:33.820-08:00</updated><title type='text'>Dynamic columns width in RDLC</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; color: #242729; display: inline ! important; float: none; font-family: Arial,&amp;quot;Helvetica Neue&amp;quot;,Helvetica,sans-serif; font-size: 15px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;I am trying to generate a RDLC report in ASP.NET where the columns of my Dataset will be dynamic and determined only at run time.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&amp;nbsp;public DataTable GetTable(int type)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DataTable table = new DataTable();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (type == 1)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; table.Columns.Add(&quot;Dosage&quot;, typeof(int));&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; table.Columns.Add(&quot;Drug&quot;, typeof(string));&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; table.Columns.Add(&quot;Patient&quot;, typeof(string));&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; table.Columns.Add(&quot;Date&quot;, typeof(DateTime));&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; table.Columns.Add(&quot;testColumn&quot;, typeof(DateTime));&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Here we add five DataRows.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; table.Rows.Add(25, &quot;Indocin&quot;, &quot;Jignesh&quot;, DateTime.Now);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; table.Rows.Add(50, &quot;Enebrel&quot;, &quot;Sam&quot;, DateTime.Now);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; table.Rows.Add(10, &quot;Hydralazine&quot;, &quot;Christoff&quot;, DateTime.Now);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; table.Rows.Add(21, &quot;Combivent&quot;, &quot;Janet&quot;, DateTime.Now);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; table.Rows.Add(100, &quot;Dilantin&quot;, &quot;Melanie&quot;, DateTime.Now);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; table.Columns.Add(&quot;Dosage&quot;, typeof(int));&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; table.Columns.Add(&quot;Patient&quot;, typeof(string));&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; table.Columns.Add(&quot;Date&quot;, typeof(DateTime));&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Here we add five DataRows.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; table.Rows.Add(25, &quot;Jignesh&quot;, DateTime.Now);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; table.Rows.Add(50, &quot;Sam&quot;, DateTime.Now);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; table.Rows.Add(10, &quot;Christoff&quot;, DateTime.Now);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; table.Rows.Add(21, &quot;Janet&quot;, DateTime.Now);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; table.Rows.Add(100, &quot;Melanie&quot;, DateTime.Now);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return table;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; color: #242729; display: inline ! important; float: none; font-family: Arial,&amp;quot;Helvetica Neue&amp;quot;,Helvetica,sans-serif; font-size: 15px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&amp;nbsp; public ActionResult GenerateReportList()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var reportDataSource = new List&lt;reportdatasource&gt;();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var localReport = new LocalReport();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var path = GeLocCommon.ReportCommonPath + GeLocCommon.RightsReport;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; path = Server.MapPath(path + GeLocCommon.M02_details);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (System.IO.File.Exists(path))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; localReport.ReportPath = path;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return RedirectToAction(&quot;Index&quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var data = GetTable(1);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; reportDataSource.Add(new ReportDataSource&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Name = GeLocCommon.RightsDetailDataSet,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Value = data&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; localReport = localReport.LocalizeReport();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var totalWidth = (float)7.215;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; totalWidth = totalWidth / data.Columns.Count; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var resizedcolumns = &quot;&amp;lt; TablixColumns &amp;gt;&quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (int i = 0; i &amp;lt; data.Columns.Count; i++)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; resizedcolumns = resizedcolumns + &quot;&amp;lt;&amp;nbsp; TablixColumn &amp;gt; &amp;lt; Width&amp;gt;&quot; + totalWidth + &quot;in&amp;lt;/ Width&amp;gt;&amp;lt; /TablixColumn&amp;nbsp; &amp;gt;&quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (int i = data.Columns.Count; i &amp;lt; 5; i++)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; resizedcolumns = resizedcolumns + &quot;&amp;lt; TablixColumn &amp;gt;&amp;lt;&amp;nbsp; Width &amp;gt;0.1in&amp;lt;/&amp;nbsp; Width&amp;nbsp; &amp;gt;&amp;lt;&amp;nbsp; /TablixColumn&amp;nbsp; &amp;gt;&quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; resizedcolumns = resizedcolumns + &quot;&amp;lt;&amp;nbsp; /TablixColumns&amp;nbsp; &amp;gt;&quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; resizedcolumns = resizedcolumns.ToString().Replace(&quot;,&quot;, &quot;.&quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var rptxml = System.IO.File.ReadAllText(path);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var start = rptxml.IndexOf(&quot;&amp;lt; TablixColumns &amp;gt;&quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var end = rptxml.IndexOf(&quot;&amp;lt; /TablixColumns&amp;nbsp; &amp;gt;&quot;) + &quot; &amp;lt; /&amp;nbsp; TablixColumns&amp;nbsp; &amp;gt;&quot;.Length;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rptxml = rptxml.Substring(0, start) + resizedcolumns + rptxml.Substring(end);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.IO.TextReader tr = new System.IO.StringReader(rptxml);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; localReport.LoadReportDefinition(tr);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tr.Close();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var downloadedFileName = GeLocCommon.RightsReportTemplate + 1 + GeLocCommon.SeperatorDash + DateTime.Now.ToString(GeLocCommon.ReportGeneratedDateFormat) + GeLocCommon.SeperatorDot + &quot;pdf&quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string mimeType;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return File(localReport.GenerateReport(ExportDataType.Pdf.ToString(), reportDataSource, null, out mimeType, false), mimeType, downloadedFileName);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;/reportdatasource&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; color: #242729; display: inline ! important; float: none; font-family: Arial,&amp;quot;Helvetica Neue&amp;quot;,Helvetica,sans-serif; font-size: 15px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; color: #242729; display: inline ! important; float: none; font-family: Arial,&amp;quot;Helvetica Neue&amp;quot;,Helvetica,sans-serif; font-size: 15px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://jigneshhirpara.blogspot.com/feeds/3197376056027202516/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jigneshhirpara.blogspot.com/2016/12/dynamic-columns-width-in-rdlc.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1603683968943160062/posts/default/3197376056027202516'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1603683968943160062/posts/default/3197376056027202516'/><link rel='alternate' type='text/html' href='http://jigneshhirpara.blogspot.com/2016/12/dynamic-columns-width-in-rdlc.html' title='Dynamic columns width in RDLC'/><author><name>Aspnet Blog</name><uri>http://www.blogger.com/profile/05026124318899904261</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='18' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjg8fG_htl_Ycu9RwdVNDUTFEN4pj2vQC5JIVWSSkzwEUWHtI_zAKWEX8AHcLhQYpVyCv_t7MzDw7CoNI1NBlagrrwvsinnwLe_a8wF8ZoTE0pNkfO1pytRog4b9RGpS_M/s220/226273_147861055282808_100001767425850_294367_7136963_n.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1603683968943160062.post-5596134290229592082</id><published>2016-04-28T04:41:00.001-07:00</published><updated>2016-04-28T04:46:35.057-07:00</updated><title type='text'>Export to excel using jquery for JQgrid</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
step 1 :create&amp;nbsp; ExportGridToExcel.ashx for open file&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;public class ExportGridToExcel : IHttpHandler&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void ProcessRequest(HttpContext context)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string tabData = context.Request[&quot;excelData&quot;];&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DataTable dt = ConvertCsvData(tabData);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (dt == null)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string excelFilename = context.Request[&quot;filename&quot;];&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (File.Exists(excelFilename))&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; File.Delete(excelFilename);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string FileName = CreateExcel.CreateExcelDocument(dt, excelFilename, context.Response); ;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string FilePath = &quot;ExcelFiles//&quot; + FileName;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; context.Response.Clear();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; context.Response.Buffer = true;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; context.Response.AddHeader(&quot;content-disposition&quot;, string.Format(&quot;attechment; filename={0}&quot;, FileName));&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string strFilePath = context.Request.PhysicalApplicationPath + FilePath;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string strExtension = System.IO.Path.GetExtension(strFilePath);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (strExtension.Equals(&quot;.xls&quot;, StringComparison.InvariantCulture) || strExtension.Equals(&quot;.csv&quot;, StringComparison.InvariantCulture) || strExtension.Equals(&quot;.xlsx&quot;, StringComparison.InvariantCulture))&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; context.Response.ContentType = &quot;application/ms-excel&quot;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if (strExtension.Equals(&quot;.pdf&quot;, StringComparison.InvariantCulture))&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; context.Response.ContentType = &quot;application/pdf&quot;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; context.Response.WriteFile(strFilePath);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; context.Response.End();&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; private DataTable ConvertCsvData(string CSVdata)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //&amp;nbsp; Convert a tab-separated set of data into a DataTable, ready for our C# CreateExcelFile libraries&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //&amp;nbsp; to turn into an Excel file.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DataTable dt = new DataTable();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Diagnostics.Trace.WriteLine(CSVdata);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string[] Lines = CSVdata.Split(new char[] { &#39;\r&#39;, &#39;\n&#39; });&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (Lines == null)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return dt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (Lines.GetLength(0) == 0)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return dt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string[] HeaderText = Lines[0].Split(&#39;\t&#39;);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int numOfColumns = HeaderText.Count();&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach (string header in HeaderText)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dt.Columns.Add(header, typeof(string));&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DataRow Row;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (int i = 1; i &amp;lt; Lines.GetLength(0); i++)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string[] Fields = Lines[i].Split(&#39;\t&#39;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (Fields.GetLength(0) == numOfColumns)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Row = dt.NewRow();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (int f = 0; f &amp;lt; numOfColumns; f++)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (Fields[f] == &quot;0&quot;)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Row[f] = &quot;&quot;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Row[f] = Fields[f].Replace(&quot;null&quot;, &quot;&quot;);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Row[f] = Row[f].ToString().Replace(&quot;&quot;, &quot;&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Row[f] = Row[f].ToString().Replace(&quot;&lt;br /&gt;
&quot;, &quot;,&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dt.Rows.Add(Row);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return dt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; catch (Exception ex)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Diagnostics.Trace.WriteLine(&quot;An exception occurred: &quot; + ex.Message);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return null;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public bool IsReusable&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; get&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return false;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; public class CreateExcel&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /// &lt;br /&gt;
&lt;summary&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /// Create an Excel file, and write it out to a MemoryStream (rather than directly to a file)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /// &lt;/summary&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /// &lt;param name=&quot;dt&quot; /&gt;DataTable containing the data to be written to the Excel.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /// &lt;param name=&quot;filename&quot; /&gt;The filename (without a path) to call the new Excel file.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /// &lt;param name=&quot;Response&quot; /&gt;HttpResponse of the current page.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /// &lt;returns&gt;True if it was created succesfully, otherwise false.&lt;/returns&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public static string&amp;nbsp; CreateExcelDocument(DataTable dt, string filename, System.Web.HttpResponse Response)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return CreateExcelDocumentAsStream(dt, filename, Response);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; catch (Exception ex)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return &quot;&quot;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /// &lt;br /&gt;
&lt;summary&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /// Create an Excel file, and write it out to a MemoryStream (rather than directly to a file)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /// &lt;/summary&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /// &lt;param name=&quot;ds&quot; /&gt;DataSet containing the data to be written to the Excel.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /// &lt;param name=&quot;filename&quot; /&gt;The filename (without a path) to call the new Excel file.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /// &lt;param name=&quot;Response&quot; /&gt;HttpResponse of the current page.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /// &lt;returns&gt;Either a MemoryStream, or NULL if something goes wrong.&lt;/returns&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public static string&amp;nbsp; CreateExcelDocumentAsStream(DataTable dt, string filename, System.Web.HttpResponse Response)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Random rnd = new Random();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string _strFile = DateTime.Now.ToString(&quot;ddMMyyyy&quot;) + &quot;_&quot; + rnd.Next(0, 9999) + &quot;.xlsx&quot;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FileInfo newFile = new FileInfo(HttpContext.Current.Server.MapPath(&quot;~/ExcelFiles/&quot; + _strFile));&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (newFile.Exists)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; newFile.Delete();&amp;nbsp; // ensures we create a new workbook&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; newFile = new FileInfo(_strFile);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ExcelPackage xlPackage = new ExcelPackage(newFile);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ExcelWorksheet xlWorkSheet = xlPackage.Workbook.Worksheets.Add(&quot;DefaultFormat&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int _RowID = 1;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xlWorkSheet.Cells.Style.Numberformat.Format = &quot;@&quot;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xlWorkSheet.Cells.Style.Numberformat.Format = &quot;General&quot;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int _Cell = 1;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (int i = 1; i &amp;lt;= dt.Columns.Count; i++)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xlWorkSheet.Cells[_RowID, _Cell].Value = dt.Columns[i - 1].ToString();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xlWorkSheet.Cells[_RowID, _Cell].Style.WrapText = true;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xlWorkSheet.Cells[_RowID, _Cell].Style.Font.Bold = true;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xlWorkSheet.Cells[_RowID, _Cell].Style.Border.Top.Style = ExcelBorderStyle.Thin;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xlWorkSheet.Cells[_RowID, _Cell].Style.Border.Left.Style = ExcelBorderStyle.Thin;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xlWorkSheet.Cells[_RowID, _Cell].Style.Border.Right.Style = ExcelBorderStyle.Thin;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xlWorkSheet.Cells[_RowID, _Cell].Style.Border.Bottom.Style = ExcelBorderStyle.Thin;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xlWorkSheet.Cells[_RowID, _Cell].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xlWorkSheet.Cells[_RowID, _Cell].Style.VerticalAlignment = ExcelVerticalAlignment.Center;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xlWorkSheet.Cells[_RowID, _Cell].Style.Numberformat.Format = &quot;@&quot;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xlWorkSheet.Cells[_RowID, _Cell].Style.Numberformat.Format = &quot;General&quot;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _Cell++;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _RowID++;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (int i = 0; i &amp;lt; dt.Rows.Count; i++)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _Cell = 1;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (int ji = 0; ji &amp;lt; dt.Columns.Count; ji++)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xlWorkSheet.Cells[_RowID, _Cell].Value = Convert.ToString(dt.Rows[i][ji]);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xlWorkSheet.Cells[_RowID, _Cell].Style.Border.Top.Style = ExcelBorderStyle.Thin;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xlWorkSheet.Cells[_RowID, _Cell].Style.Border.Left.Style = ExcelBorderStyle.Thin;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xlWorkSheet.Cells[_RowID, _Cell].Style.Border.Right.Style = ExcelBorderStyle.Thin;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xlWorkSheet.Cells[_RowID, _Cell].Style.Border.Bottom.Style = ExcelBorderStyle.Thin;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xlWorkSheet.Cells[_RowID, _Cell].Style.HorizontalAlignment = ExcelHorizontalAlignment.Left;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xlWorkSheet.Cells[_RowID, _Cell].Style.VerticalAlignment = ExcelVerticalAlignment.Center;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xlWorkSheet.Cells[_RowID, _Cell].Style.Numberformat.Format = &quot;@&quot;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xlWorkSheet.Cells[_RowID, _Cell].Style.Numberformat.Format = &quot;General&quot;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _Cell++;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _RowID++;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xlWorkSheet.Cells.AutoFitColumns();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xlPackage.Save();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xlPackage.Dispose();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return _strFile;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; catch (Exception ex)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return &quot;&quot;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Step 2 Js file&lt;br /&gt;
&lt;br /&gt;
function ExportJQGridDataToExcel(tableCtrl, excelFilename) {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; //&amp;nbsp; Export the data from our jqGrid into a (real !) Excel .xlsx file.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; //&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; //&amp;nbsp; We&#39;ll build up a (very large?) tab-separated string containing the data to be exported, then POST them &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; //&amp;nbsp; off to a .ashx handler, which creates the Excel file.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; debugger&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; var allJQGridData = $(tableCtrl).jqGrid(&#39;getGridParam&#39;, &#39;data&#39;);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; var jqgridRowIDs = $(tableCtrl).getDataIDs();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Fetch the RowIDs for this grid&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; var headerData = $(tableCtrl).getRowData(jqgridRowIDs[0]);&amp;nbsp;&amp;nbsp; // Fetch the list of &quot;name&quot; values in our colModel&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; //&amp;nbsp; For each visible column in our jqGrid, fetch it&#39;s Name, and it&#39;s Header-Text value&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; var columnNames = new Array();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //&amp;nbsp; The &quot;name&quot; values from our jqGrid colModel&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; var columnHeaders = new Array();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //&amp;nbsp; The Header-Text, from the jqGrid &quot;colNames&quot; section&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; var inx = 0;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; var allColumnNames = $(tableCtrl).jqGrid(&#39;getGridParam&#39;, &#39;colNames&#39;);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; for (var headerValue in headerData) {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //&amp;nbsp; If this column ISN&#39;T hidden, and DOES have a column-name, then we&#39;ll export its data to Excel.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var isColumnHidden = $(tableCtrl).jqGrid(&quot;getColProp&quot;, headerValue).hidden;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (!isColumnHidden &amp;amp;&amp;amp; headerValue != null) {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; columnNames.push(headerValue);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; columnHeaders.push(allColumnNames[inx]);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; inx++;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; //&amp;nbsp; We now need to build up a (potentially very long) tab-separated string containing all of the data (and a header row)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; //&amp;nbsp; which we&#39;ll want to export to Excel.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; //&amp;nbsp; First, let&#39;s append the header row...&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; var excelData = &#39;&#39;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; for (var k = 0; k &amp;lt; columnNames.length; k++) {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; excelData += columnHeaders[k] + &quot;\t&quot;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; excelData = removeLastChar(excelData) + &quot;\r\n&quot;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; //&amp;nbsp; ..then each row of data to be exported.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; var cellValue = &#39;&#39;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; for (i = 0; i &amp;lt; allJQGridData.length; i++) {&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var data = allJQGridData[i];&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (var j = 0; j &amp;lt; columnNames.length; j++) {&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Fetch one jqGrid cell&#39;s data, but make sure it&#39;s a string&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cellValue = &#39;&#39; + data[columnNames[j]];&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (cellValue == null)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; excelData += &quot;\t&quot;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (cellValue.indexOf(&quot;a href&quot;) &amp;gt; -1) {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //&amp;nbsp; Some of my cells have a jqGrid cell with a formatter in them, making them hyperlinks.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //&amp;nbsp; We don&#39;t want to export the &quot;&lt;a href..=&quot;&quot; href=&quot;https://www.blogger.com/null&quot;&gt; &lt;/a&gt;&quot; tags to our Excel file, just the cell&#39;s text.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cellValue = $(cellValue).text();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //&amp;nbsp; Make sure we are able to POST data containing apostrophes in it&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cellValue = cellValue.replace(/&#39;/g, &quot;&#39;&quot;);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; excelData += cellValue + &quot;\t&quot;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; excelData = removeLastChar(excelData) + &quot;\r\n&quot;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; //&amp;nbsp; Now, we need to POST our Excel Data to our .ashx file *and* redirect to the .ashx file.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; postAndRedirect(&quot;../../Handlers/ExportGridToExcel.ashx?filename=&quot; + excelFilename, { excelData: excelData });&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function removeLastChar(str) {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; //&amp;nbsp; Remove the last character from a string&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; return str.substring(0, str.length - 1);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function postAndRedirect(url, postData) {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; //&amp;nbsp; Redirect to a URL, and POST some data to it.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; //&amp;nbsp; Taken from:&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; //&amp;nbsp; http://stackoverflow.com/questions/8389646/send-post-data-on-redirect-with-javascript-jquery&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; //&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; var postFormStr = &quot;&lt;br /&gt;
&lt;form action=&quot;&amp;quot; + url + &amp;quot;&quot; method=&quot;POST&quot;&gt;
\n&quot;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; for (var key in postData) {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (postData.hasOwnProperty(key)) {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; postFormStr += &quot;&lt;input name=&quot;&amp;quot; + key + &amp;quot;&quot; type=&quot;hidden&quot; value=&quot;&amp;quot; + postData[key] + &amp;quot;&quot; /&gt;&quot;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; postFormStr += &quot;&lt;/form&gt;
&quot;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; var formElement = $(postFormStr);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; $(&#39;body&#39;).append(formElement);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; $(formElement).submit();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
step 3&amp;nbsp; Add js code in jqgriid&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; $(&quot;#jqTable&quot;).navButtonAdd(&#39;#jqTablePager&#39;, {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; title: &quot;Export to Excel&quot;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; buttonicon: &quot;ace-icon fa fa-file-excel-o&quot;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; caption: &quot;&quot;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; onClickButton: function () {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ExportJQGridDataToExcel(&quot;#jqTable&quot;, &quot;ExcelName.xlsx&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; },&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; position: &quot;last&quot;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;br /&gt;
if data not display in excel please set below property in JqGrid&lt;br /&gt;
loadonce: true,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Thanks&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://jigneshhirpara.blogspot.com/feeds/5596134290229592082/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jigneshhirpara.blogspot.com/2016/04/export-to-excel-using-jquery-for-jqgrid.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1603683968943160062/posts/default/5596134290229592082'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1603683968943160062/posts/default/5596134290229592082'/><link rel='alternate' type='text/html' href='http://jigneshhirpara.blogspot.com/2016/04/export-to-excel-using-jquery-for-jqgrid.html' title='Export to excel using jquery for JQgrid'/><author><name>Aspnet Blog</name><uri>http://www.blogger.com/profile/05026124318899904261</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='18' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjg8fG_htl_Ycu9RwdVNDUTFEN4pj2vQC5JIVWSSkzwEUWHtI_zAKWEX8AHcLhQYpVyCv_t7MzDw7CoNI1NBlagrrwvsinnwLe_a8wF8ZoTE0pNkfO1pytRog4b9RGpS_M/s220/226273_147861055282808_100001767425850_294367_7136963_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1603683968943160062.post-4302870425622816703</id><published>2016-04-25T04:23:00.002-07:00</published><updated>2016-04-25T04:23:52.491-07:00</updated><title type='text'>Upload document using Ajax call</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&amp;nbsp;submitHandler: function (form) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var $form = $(&quot;#frmQuestion&quot;), formData = new FormData(), params = $form.serializeArray();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $.each(params, function (i, val) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; formData.append(val.name, val.value);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var files = $(&quot;input[Type=&#39;file&#39;]&quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (var i = 0; i &amp;lt; files.length; i++) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; formData.append(files[i].name, $(&#39;#&#39; + files[i].id).get(0).files[0]);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $.ajax({&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; url: &#39;/Questions/SaveQuestion&#39;,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data: formData,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cache: false,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; contentType: false,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; processData: false,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; type: &#39;POST&#39;,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mimeType: &quot;multipart/form-data&quot;,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; beforeSend: function () { ShowCustomLoading(true); },&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; complete: function () { ShowCustomLoading(false); },&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; success: function (datas) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var data = JSON.parse(datas)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (data.Key == true) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new PNotify({&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; text: data.Value,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; delay: 1500,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; type: &#39;success&#39;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $(&quot;#divlist&quot;).show();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $(&quot;#divAdd&quot;).hide();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $(&quot;#jqTable&quot;).trigger(&#39;reloadGrid&#39;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new PNotify({&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; text: data.Value,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; delay: 1500,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; type: &#39;error&#39;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://jigneshhirpara.blogspot.com/feeds/4302870425622816703/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jigneshhirpara.blogspot.com/2016/04/upload-document-using-ajax-call.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1603683968943160062/posts/default/4302870425622816703'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1603683968943160062/posts/default/4302870425622816703'/><link rel='alternate' type='text/html' href='http://jigneshhirpara.blogspot.com/2016/04/upload-document-using-ajax-call.html' title='Upload document using Ajax call'/><author><name>Aspnet Blog</name><uri>http://www.blogger.com/profile/05026124318899904261</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='18' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjg8fG_htl_Ycu9RwdVNDUTFEN4pj2vQC5JIVWSSkzwEUWHtI_zAKWEX8AHcLhQYpVyCv_t7MzDw7CoNI1NBlagrrwvsinnwLe_a8wF8ZoTE0pNkfO1pytRog4b9RGpS_M/s220/226273_147861055282808_100001767425850_294367_7136963_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1603683968943160062.post-480451506029635437</id><published>2012-05-03T01:54:00.001-07:00</published><updated>2012-05-03T01:54:51.539-07:00</updated><title type='text'>Exporting to Word, Excel ,pdf and CSV</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;col&quot; id=&quot;body&quot; style=&quot;font-size: 12px; margin-right: 5px; min-height: 1300px; width: 620px;&quot;&gt;
&lt;div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;span style=&quot;font-family: arial,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;In this article, I will explain how to export GridView to Word, Excel, PDF and CSV formats.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;span style=&quot;font-family: arial,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Exporting 
to Word, Excel and CSV can be easily achieved using ASP.Net without any 
third party tools, but for exporting GridView to PDF I am using &lt;a href=&quot;http://itextsharp.sourceforge.net/&quot; target=&quot;_blank&quot;&gt;iTextSharp&lt;/a&gt; which is a free library for exporting html to PDF.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;span style=&quot;font-family: arial,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;To start with I have a GridView in which I am showing Customers records from the NorthWind Database.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;span style=&quot;font-family: arial,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;The HTML markup of the GridView is as shown below&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;border-bottom: windowtext 1pt solid; border-left: windowtext 1pt solid; border-right: windowtext 1pt solid; border-top: windowtext 1pt solid; padding-bottom: 1pt; padding-left: 4pt; padding-right: 4pt; padding-top: 1pt;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: &#39;courier new&#39;;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon; font-family: &#39;courier new&#39;;&quot;&gt;asp&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &#39;courier new&#39;;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: maroon; font-family: &#39;courier new&#39;;&quot;&gt;GridView&lt;/span&gt;&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt; &lt;span style=&quot;color: red;&quot;&gt;ID&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;GridView1&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;runat&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;server&quot;&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: red;&quot;&gt;AutoGenerateColumns&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&quot;false&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;Font-Names&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&quot;Arial&quot;&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: red;&quot;&gt;Font-Size&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&quot;11pt&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;AlternatingRowStyle-BackColor&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&quot;#C2D69B&quot;&lt;/span&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: red;&quot;&gt;HeaderStyle-BackColor&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&quot;green&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;AllowPaging&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;=&quot;true&quot;&lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: red;&quot;&gt;OnPageIndexChanging&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&quot;OnPaging&quot;&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;Columns&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;BoundField&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;ItemStyle-Width&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&quot;150px&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;DataField&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&quot;CustomerID&quot;&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: red;&quot;&gt;HeaderText&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&quot;CustomerID&quot;&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;BoundField&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;ItemStyle-Width&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&quot;150px&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;DataField&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&quot;City&quot;&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: red;&quot;&gt;HeaderText&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&quot;City&quot;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;BoundField&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;ItemStyle-Width&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&quot;150px&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;DataField&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&quot;Country&quot;&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: red;&quot;&gt;HeaderText&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&quot;Country&quot;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;BoundField&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;ItemStyle-Width&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&quot;150px&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;DataField&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&quot;PostalCode&quot;&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: red;&quot;&gt;HeaderText&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&quot;PostalCode&quot;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;color: maroon;&quot;&gt;Columns&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 6pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;color: maroon; font-family: &#39;courier new&#39;;&quot;&gt;asp&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &#39;courier new&#39;;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: maroon; font-family: &#39;courier new&#39;;&quot;&gt;GridView&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &#39;courier new&#39;;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;span style=&quot;font-family: arial,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;In the figure below the GridView is shown with four buttons&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpFirst&quot; style=&quot;margin: 0in 0in 0pt 0.25in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;font-family: arial,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;1.&lt;/span&gt;&lt;span style=&quot;font: 7pt &#39;times new roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: arial,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Export To Word&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;margin: 0in 0in 0pt 0.25in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;font-family: arial,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;2.&lt;/span&gt;&lt;span style=&quot;font: 7pt &#39;times new roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: arial,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Export To Excel&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;margin: 0in 0in 0pt 0.25in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;font-family: arial,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;3.&lt;/span&gt;&lt;span style=&quot;font: 7pt &#39;times new roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: arial,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Export To PDF&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpLast&quot; style=&quot;margin: 0in 0in 6pt 0.25in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;font-family: arial,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;4.&lt;/span&gt;&lt;span style=&quot;font: 7pt &#39;times new roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: arial,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Export To CSV&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;img alt=&quot;GridView with Sample Data&quot; src=&quot;http://www.aspsnippets.com/Handlers/DownloadFile.ashx?File=68d2c5af-b131-407a-817e-8bc85900c152.PNG&quot; style=&quot;height: 450px; width: 596px;&quot; /&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: arial,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Export to Microsoft Word Format&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: arial,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;C#&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;border-bottom: windowtext 1pt solid; border-left: windowtext 1pt solid; border-right: windowtext 1pt solid; border-top: windowtext 1pt solid; padding-bottom: 1pt; padding-left: 4pt; padding-right: 4pt; padding-top: 1pt;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: &#39;courier new&#39;;&quot;&gt;protected&lt;/span&gt;&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; btnExportWord_Click(&lt;span style=&quot;color: blue;&quot;&gt;object&lt;/span&gt; sender, &lt;span style=&quot;color: teal;&quot;&gt;EventArgs&lt;/span&gt; e)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.Clear();&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.Buffer = &lt;span style=&quot;color: blue;&quot;&gt;true&lt;/span&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.AddHeader(&lt;span style=&quot;color: maroon;&quot;&gt;&quot;content-disposition&quot;&lt;/span&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: maroon;&quot;&gt;&quot;attachment;filename=GridViewExport.doc&quot;&lt;/span&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.Charset = &lt;span style=&quot;color: maroon;&quot;&gt;&quot;&quot;&lt;/span&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.ContentType = &lt;span style=&quot;color: maroon;&quot;&gt;&quot;application/vnd.ms-word &quot;&lt;/span&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;StringWriter&lt;/span&gt; sw= &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;StringWriter&lt;/span&gt;();&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;HtmlTextWriter&lt;/span&gt; hw = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;HtmlTextWriter&lt;/span&gt;(sw);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; GridView1.AllowPaging = &lt;span style=&quot;color: blue;&quot;&gt;false&lt;/span&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; GridView1.DataBind(); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; GridView1.RenderControl(hw);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.Output.Write(sw.ToString());&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.Flush();&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.End();&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 6pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: arial,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;VB.Net&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;border-bottom: windowtext 1pt solid; border-left: windowtext 1pt solid; border-right: windowtext 1pt solid; border-top: windowtext 1pt solid; padding-bottom: 1pt; padding-left: 4pt; padding-right: 4pt; padding-top: 1pt;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: &#39;courier new&#39;;&quot;&gt;Protected&lt;/span&gt;&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;Sub&lt;/span&gt; btnExportWord_Click(&lt;span style=&quot;color: blue;&quot;&gt;ByVal&lt;/span&gt; sender &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Object&lt;/span&gt;, &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;ByVal&lt;/span&gt; e &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; EventArgs)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.Clear()&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.Buffer = &lt;span style=&quot;color: blue;&quot;&gt;True&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.AddHeader(&lt;span style=&quot;color: maroon;&quot;&gt;&quot;content-disposition&quot;&lt;/span&gt;, &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: maroon;&quot;&gt;&quot;attachment;filename=GridViewExport.doc&quot;&lt;/span&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.Charset = &lt;span style=&quot;color: maroon;&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.ContentType = &lt;span style=&quot;color: maroon;&quot;&gt;&quot;application/vnd.ms-word &quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;Dim&lt;/span&gt; sw &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;New&lt;/span&gt; StringWriter()&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;Dim&lt;/span&gt; hw &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;New&lt;/span&gt; HtmlTextWriter(sw)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GridView1.AllowPaging = &lt;span style=&quot;color: blue;&quot;&gt;False&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GridView1.DataBind()&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GridView1.RenderControl(hw)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.Output.Write(sw.ToString())&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.Flush()&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.End()&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 6pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Sub&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;span style=&quot;font-family: arial,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;The above 
function renders the GridView contents as Microsoft Word format. You 
will notice I have disabled paging before exporting, so that all the 
pages are exported.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;span style=&quot;font-family: arial,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;The Output Exported File&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;img alt=&quot;GridView data exported to Word Document&quot; src=&quot;http://www.aspsnippets.com/Handlers/DownloadFile.ashx?File=03df5e34-1ced-4a04-ad5a-7a85502f966b.PNG&quot; style=&quot;height: 550px; width: 592px;&quot; /&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: arial,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Export to Microsoft Excel Format&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;span style=&quot;font-family: arial,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;For 
exporting the document to Excel if you do it directly as done in case of
 word the row background color is applied throughout to all the columns 
in the Excel Sheet hence in order to avoid it. I have done a workaround 
below.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;span style=&quot;font-family: arial,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;First I am changing the background color of each row back to white.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;span style=&quot;font-family: arial,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Then I am 
applying the background color to each individual cell rather than the 
whole row. Thus when you export now you will notice that the formatting 
is applied only to the GridView cells and not all&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;span style=&quot;font-family: arial,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Also I am applying &lt;b&gt;textmode&lt;/b&gt; style class to all cells and then adding the style &lt;b&gt;CSS&lt;/b&gt; class to the GridView before rendering it, this ensures that all the contents of GridView are rendered as text.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;border-bottom: windowtext 1pt solid; border-left: windowtext 1pt solid; border-right: windowtext 1pt solid; border-top: windowtext 1pt solid; padding-bottom: 1pt; padding-left: 1pt; padding-right: 1pt; padding-top: 1pt;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: &#39;courier new&#39;;&quot;&gt;protected&lt;/span&gt;&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; btnExportExcel_Click(&lt;span style=&quot;color: blue;&quot;&gt;object&lt;/span&gt; sender, &lt;span style=&quot;color: teal;&quot;&gt;EventArgs&lt;/span&gt; e)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Response.Clear();&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Response.Buffer = &lt;span style=&quot;color: blue;&quot;&gt;true&lt;/span&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Response.AddHeader(&lt;span style=&quot;color: maroon;&quot;&gt;&quot;content-disposition&quot;&lt;/span&gt;, &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: maroon; font-family: &#39;courier new&#39;;&quot;&gt;&quot;attachment;filename=GridViewExport.xls&quot;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Response.Charset = &lt;span style=&quot;color: maroon;&quot;&gt;&quot;&quot;&lt;/span&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Response.ContentType = &lt;span style=&quot;color: maroon;&quot;&gt;&quot;application/vnd.ms-excel&quot;&lt;/span&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: teal; font-family: &#39;courier new&#39;;&quot;&gt;StringWriter&lt;/span&gt;&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt; sw = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;StringWriter&lt;/span&gt;();&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: teal; font-family: &#39;courier new&#39;;&quot;&gt;HtmlTextWriter&lt;/span&gt;&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt; hw = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;HtmlTextWriter&lt;/span&gt;(sw);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;GridView1.AllowPaging = &lt;span style=&quot;color: blue;&quot;&gt;false&lt;/span&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;GridView1.DataBind(); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;//Change the Header Row back to white color&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;GridView1.HeaderRow.Style.Add(&lt;span style=&quot;color: maroon;&quot;&gt;&quot;background-color&quot;&lt;/span&gt;, &lt;span style=&quot;color: maroon;&quot;&gt;&quot;#FFFFFF&quot;&lt;/span&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;//Apply style to Individual Cells&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;GridView1.HeaderRow.Cells[0].Style.Add(&lt;span style=&quot;color: maroon;&quot;&gt;&quot;background-color&quot;&lt;/span&gt;, &lt;span style=&quot;color: maroon;&quot;&gt;&quot;green&quot;&lt;/span&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;GridView1.HeaderRow.Cells[1].Style.Add(&lt;span style=&quot;color: maroon;&quot;&gt;&quot;background-color&quot;&lt;/span&gt;, &lt;span style=&quot;color: maroon;&quot;&gt;&quot;green&quot;&lt;/span&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;GridView1.HeaderRow.Cells[2].Style.Add(&lt;span style=&quot;color: maroon;&quot;&gt;&quot;background-color&quot;&lt;/span&gt;, &lt;span style=&quot;color: maroon;&quot;&gt;&quot;green&quot;&lt;/span&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;GridView1.HeaderRow.Cells[3].Style.Add(&lt;span style=&quot;color: maroon;&quot;&gt;&quot;background-color&quot;&lt;/span&gt;, &lt;span style=&quot;color: maroon;&quot;&gt;&quot;green&quot;&lt;/span&gt;);&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: &#39;courier new&#39;;&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt; (&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt; i = 0; i &amp;lt; GridView1.Rows.Count;i++ )&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;GridViewRow&lt;/span&gt; row = GridView1.Rows[i];&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: green;&quot;&gt;//Change Color back to white&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.BackColor = System.Drawing.&lt;span style=&quot;color: teal;&quot;&gt;Color&lt;/span&gt;.White;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: green;&quot;&gt;//Apply text style to each Row&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.Attributes.Add(&lt;span style=&quot;color: maroon;&quot;&gt;&quot;class&quot;&lt;/span&gt;, &lt;span style=&quot;color: maroon;&quot;&gt;&quot;textmode&quot;&lt;/span&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: green;&quot;&gt;//Apply style to Individual Cells of Alternating Row&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt; (i % 2 != 0)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.Cells[0].Style.Add(&lt;span style=&quot;color: maroon;&quot;&gt;&quot;background-color&quot;&lt;/span&gt;, &lt;span style=&quot;color: maroon;&quot;&gt;&quot;#C2D69B&quot;&lt;/span&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.Cells[1].Style.Add(&lt;span style=&quot;color: maroon;&quot;&gt;&quot;background-color&quot;&lt;/span&gt;, &lt;span style=&quot;color: maroon;&quot;&gt;&quot;#C2D69B&quot;&lt;/span&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.Cells[2].Style.Add(&lt;span style=&quot;color: maroon;&quot;&gt;&quot;background-color&quot;&lt;/span&gt;, &lt;span style=&quot;color: maroon;&quot;&gt;&quot;#C2D69B&quot;&lt;/span&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.Cells[3].Style.Add(&lt;span style=&quot;color: maroon;&quot;&gt;&quot;background-color&quot;&lt;/span&gt;, &lt;span style=&quot;color: maroon;&quot;&gt;&quot;#C2D69B&quot;&lt;/span&gt;);&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;GridView1.RenderControl(hw);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;//style to format numbers to string&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: &#39;courier new&#39;;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt; style = &lt;span style=&quot;color: maroon;&quot;&gt;@&quot;&lt;style&gt;
 .textmode { mso-number-format:\@; } 
&lt;/style&gt;&quot;&lt;/span&gt;; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Response.Write(style); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Response.Output.Write(sw.ToString());&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Response.Flush();&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Response.End();&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: arial,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;VB.Net&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;border-bottom: windowtext 1pt solid; border-left: windowtext 1pt solid; border-right: windowtext 1pt solid; border-top: windowtext 1pt solid; padding-bottom: 1pt; padding-left: 1pt; padding-right: 1pt; padding-top: 1pt;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: &#39;courier new&#39;;&quot;&gt;Protected&lt;/span&gt;&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;Sub&lt;/span&gt; btnExportExcel_Click(&lt;span style=&quot;color: blue;&quot;&gt;ByVal&lt;/span&gt; sender &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Object&lt;/span&gt;, &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: &#39;courier new&#39;;&quot;&gt;ByVal&lt;/span&gt;&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt; e &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; EventArgs)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; Response.Clear()&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; Response.Buffer = &lt;span style=&quot;color: blue;&quot;&gt;True&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; Response.AddHeader(&lt;span style=&quot;color: maroon;&quot;&gt;&quot;content-disposition&quot;&lt;/span&gt;, &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &lt;span style=&quot;color: maroon;&quot;&gt;&quot;attachment;filename=GridViewExport.xls&quot;&lt;/span&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; Response.Charset = &lt;span style=&quot;color: maroon;&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; Response.ContentType = &lt;span style=&quot;color: maroon;&quot;&gt;&quot;application/vnd.ms-excel&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;Dim&lt;/span&gt; sw &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;New&lt;/span&gt; StringWriter()&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;Dim&lt;/span&gt; hw &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;New&lt;/span&gt; HtmlTextWriter(sw)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; GridView1.AllowPaging = &lt;span style=&quot;color: blue;&quot;&gt;False&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; GridView1.DataBind()&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &lt;span style=&quot;color: green;&quot;&gt;&#39;Change the Header Row back to white color &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; GridView1.HeaderRow.Style.Add(&lt;span style=&quot;color: maroon;&quot;&gt;&quot;background-color&quot;&lt;/span&gt;, &lt;span style=&quot;color: maroon;&quot;&gt;&quot;#FFFFFF&quot;&lt;/span&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &lt;span style=&quot;color: green;&quot;&gt;&#39;Apply style to Individual Cells &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; GridView1.HeaderRow.Cells(0).Style.Add(&lt;span style=&quot;color: maroon;&quot;&gt;&quot;background-color&quot;&lt;/span&gt;, &lt;span style=&quot;color: maroon;&quot;&gt;&quot;green&quot;&lt;/span&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; GridView1.HeaderRow.Cells(1).Style.Add(&lt;span style=&quot;color: maroon;&quot;&gt;&quot;background-color&quot;&lt;/span&gt;, &lt;span style=&quot;color: maroon;&quot;&gt;&quot;green&quot;&lt;/span&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; GridView1.HeaderRow.Cells(2).Style.Add(&lt;span style=&quot;color: maroon;&quot;&gt;&quot;background-color&quot;&lt;/span&gt;, &lt;span style=&quot;color: maroon;&quot;&gt;&quot;green&quot;&lt;/span&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; GridView1.HeaderRow.Cells(3).Style.Add(&lt;span style=&quot;color: maroon;&quot;&gt;&quot;background-color&quot;&lt;/span&gt;, &lt;span style=&quot;color: maroon;&quot;&gt;&quot;green&quot;&lt;/span&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;For&lt;/span&gt; i &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Integer&lt;/span&gt; = 0 &lt;span style=&quot;color: blue;&quot;&gt;To&lt;/span&gt; GridView1.Rows.Count - 1&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;Dim&lt;/span&gt; row &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; GridViewRow = GridView1.Rows(i)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: green;&quot;&gt;&#39;Change Color back to white &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; row.BackColor = System.Drawing.Color.White&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: green;&quot;&gt;&#39;Apply text style to each Row &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; row.Attributes.Add(&lt;span style=&quot;color: maroon;&quot;&gt;&quot;class&quot;&lt;/span&gt;, &lt;span style=&quot;color: maroon;&quot;&gt;&quot;textmode&quot;&lt;/span&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: green;&quot;&gt;&#39;Apply style to Individual Cells of Alternating Row &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;If&lt;/span&gt; i &lt;span style=&quot;color: blue;&quot;&gt;Mod&lt;/span&gt; 2 &amp;lt;&amp;gt; 0 &lt;span style=&quot;color: blue;&quot;&gt;Then&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.Cells(0).Style.Add(&lt;span style=&quot;color: maroon;&quot;&gt;&quot;background-color&quot;&lt;/span&gt;, &lt;span style=&quot;color: maroon;&quot;&gt;&quot;#C2D69B&quot;&lt;/span&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.Cells(1).Style.Add(&lt;span style=&quot;color: maroon;&quot;&gt;&quot;background-color&quot;&lt;/span&gt;, &lt;span style=&quot;color: maroon;&quot;&gt;&quot;#C2D69B&quot;&lt;/span&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.Cells(2).Style.Add(&lt;span style=&quot;color: maroon;&quot;&gt;&quot;background-color&quot;&lt;/span&gt;, &lt;span style=&quot;color: maroon;&quot;&gt;&quot;#C2D69B&quot;&lt;/span&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.Cells(3).Style.Add(&lt;span style=&quot;color: maroon;&quot;&gt;&quot;background-color&quot;&lt;/span&gt;, &lt;span style=&quot;color: maroon;&quot;&gt;&quot;#C2D69B&quot;&lt;/span&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;If&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;Next&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; GridView1.RenderControl(hw)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &lt;span style=&quot;color: green;&quot;&gt;&#39;style to format numbers to string &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;Dim&lt;/span&gt; style &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;String&lt;/span&gt; = &lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;style&gt;
.textmode{mso-number-format:\@;}
&lt;/style&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; Response.Write(style)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; Response.Output.Write(sw.ToString())&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; Response.Flush()&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; Response.End()&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 6pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: &#39;courier new&#39;;&quot;&gt;End&lt;/span&gt;&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;Sub&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;span style=&quot;font-family: arial,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;The Output Exported File&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;img alt=&quot;GridView data exported to Excel Document&quot; src=&quot;http://www.aspsnippets.com/Handlers/DownloadFile.ashx?File=9d94ff9f-7291-4512-b365-0dbded04f30f.PNG&quot; style=&quot;height: 550px; width: 588px;&quot; /&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: arial,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Export to Portable Document Format&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;span style=&quot;font-family: arial,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;For 
exporting the GridView to PDF I am using the iTextSharp Library. You 
will need to Add Reference for the iTextSharp Library in your Website.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;span style=&quot;font-family: arial,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Then import the following Namespaces&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: arial,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;C#&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;border-bottom: windowtext 1pt solid; border-left: windowtext 1pt solid; border-right: windowtext 1pt solid; border-top: windowtext 1pt solid; padding-bottom: 1pt; padding-left: 4pt; padding-right: 4pt; padding-top: 1pt;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: &#39;courier new&#39;;&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt; iTextSharp.text;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: &#39;courier new&#39;;&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt; iTextSharp.text.pdf;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: &#39;courier new&#39;;&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt; iTextSharp.text.html;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 6pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: &#39;courier new&#39;;&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt; iTextSharp.text.html.simpleparser;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: arial,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;VB.Net&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;border-bottom: windowtext 1pt solid; border-left: windowtext 1pt solid; border-right: windowtext 1pt solid; border-top: windowtext 1pt solid; padding-bottom: 1pt; padding-left: 4pt; padding-right: 4pt; padding-top: 1pt;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: &#39;courier new&#39;;&quot;&gt;Imports&lt;/span&gt;&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt; iTextSharp.text&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: &#39;courier new&#39;;&quot;&gt;Imports&lt;/span&gt;&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt; iTextSharp.text.pdf&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: &#39;courier new&#39;;&quot;&gt;Imports&lt;/span&gt;&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt; iTextSharp.text.html&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 6pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: &#39;courier new&#39;;&quot;&gt;Imports&lt;/span&gt;&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt; iTextSharp.text.html.simpleparser&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;span style=&quot;font-family: arial,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;By default the iTextSharp Library does not support background color of table cells or table rows&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;span style=&quot;font-family: arial,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Hence when you render it as PDF your GridView is rendered without any formatting.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;span style=&quot;font-family: arial,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Recently I read an article on &lt;a href=&quot;http://hamang.net/&quot; target=&quot;_blank&quot;&gt;hamang.net&lt;/a&gt; where the author has provided the snippet to modify the iTextSharp so that it exports the HTML with background color.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;span style=&quot;font-family: arial,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;For this 
tutorial, I have already modified the iTextSharp Library DLL so that the
 GridView is rendered with all the background color used. You can refer 
the code for exporting GridView to PDF below&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;/div&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
 &lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: arial,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;C#&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;border-bottom: windowtext 1pt solid; border-left: windowtext 1pt solid; border-right: windowtext 1pt solid; border-top: windowtext 1pt solid; padding-bottom: 1pt; padding-left: 4pt; padding-right: 4pt; padding-top: 1pt;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: &#39;courier new&#39;;&quot;&gt;protected&lt;/span&gt;&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; btnExportPDF_Click(&lt;span style=&quot;color: blue;&quot;&gt;object&lt;/span&gt; sender, &lt;span style=&quot;color: teal;&quot;&gt;EventArgs&lt;/span&gt; e)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.ContentType = &lt;span style=&quot;color: maroon;&quot;&gt;&quot;application/pdf&quot;&lt;/span&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.AddHeader(&lt;span style=&quot;color: maroon;&quot;&gt;&quot;content-disposition&quot;&lt;/span&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: maroon;&quot;&gt;&quot;attachment;filename=GridViewExport.pdf&quot;&lt;/span&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.Cache.SetCacheability(&lt;span style=&quot;color: teal;&quot;&gt;HttpCacheability&lt;/span&gt;.NoCache);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;StringWriter&lt;/span&gt; sw = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;StringWriter&lt;/span&gt;();&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;HtmlTextWriter&lt;/span&gt; hw = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;HtmlTextWriter&lt;/span&gt;(sw);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; GridView1.AllowPaging = &lt;span style=&quot;color: blue;&quot;&gt;false&lt;/span&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; GridView1.DataBind(); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; GridView1.RenderControl(hw);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;StringReader&lt;/span&gt; sr = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;StringReader&lt;/span&gt;(sw.ToString());&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;Document&lt;/span&gt; pdfDoc = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;Document&lt;/span&gt;(&lt;span style=&quot;color: teal;&quot;&gt;PageSize&lt;/span&gt;.A4, 10f,10f,10f,0f);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;HTMLWorker&lt;/span&gt; htmlparser = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;HTMLWorker&lt;/span&gt;(pdfDoc);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;PdfWriter&lt;/span&gt;.GetInstance(pdfDoc, Response.OutputStream);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pdfDoc.Open();&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; htmlparser.Parse(sr);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pdfDoc.Close();&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.Write(pdfDoc);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.End();&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 6pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: arial,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;VB.Net&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;border-bottom: windowtext 1pt solid; border-left: windowtext 1pt solid; border-right: windowtext 1pt solid; border-top: windowtext 1pt solid; padding-bottom: 1pt; padding-left: 4pt; padding-right: 4pt; padding-top: 1pt;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: &#39;courier new&#39;;&quot;&gt;Protected&lt;/span&gt;&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;Sub&lt;/span&gt; btnExportPDF_Click(&lt;span style=&quot;color: blue;&quot;&gt;ByVal&lt;/span&gt; sender &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Object&lt;/span&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: &#39;courier new&#39;;&quot;&gt;ByVal&lt;/span&gt;&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt; e &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; EventArgs)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;Response.ContentType = &lt;span style=&quot;color: maroon;&quot;&gt;&quot;application/pdf&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;Response.AddHeader(&lt;span style=&quot;color: maroon;&quot;&gt;&quot;content-disposition&quot;&lt;/span&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;attachment;filename=GridViewExport.pdf&quot;&lt;/span&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;Response.Cache.SetCacheability(HttpCacheability.NoCache)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;Dim&lt;/span&gt; sw &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;New&lt;/span&gt; StringWriter()&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;Dim&lt;/span&gt; hw &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;New&lt;/span&gt; HtmlTextWriter(sw)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;GridView1.AllowPaging = &lt;span style=&quot;color: blue;&quot;&gt;False&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;GridView1.DataBind()&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;GridView1.RenderControl(hw)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;Dim&lt;/span&gt; sr &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;New&lt;/span&gt; StringReader(sw.ToString())&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;Dim&lt;/span&gt; pdfDoc &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;New&lt;/span&gt; Document(PageSize.A4, 10.0F, 10.0F, 10.0F, 0.0F)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;Dim&lt;/span&gt; htmlparser &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;New&lt;/span&gt; HTMLWorker(pdfDoc)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;PdfWriter.GetInstance(pdfDoc, Response.OutputStream)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;pdfDoc.Open()&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;htmlparser.Parse(sr)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;pdfDoc.Close()&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;Response.Write(pdfDoc)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;Response.End()&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: &#39;courier new&#39;;&quot;&gt;End&lt;/span&gt;&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;Sub&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;span style=&quot;font-family: arial,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;The Output Exported File&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;img alt=&quot;GridView data exported to PDF Document&quot; src=&quot;http://www.aspsnippets.com/Handlers/DownloadFile.ashx?File=3abc37e6-2bb4-4319-8fd7-cc4e95dbd920.PNG&quot; style=&quot;height: 498px; width: 592px;&quot; /&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: arial,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Export to Text/CSV&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;span style=&quot;font-family: arial,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Finally comes exporting GridView to CSV or Text File delimited by a separator like comma.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;span style=&quot;font-family: arial,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;To export 
the GridView as CSV, I am running a two for loops. While looping through
 the GridView columns and appending comma after each column and while 
looping through rows appending new line character. Refer the code below.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: arial,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;C#&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;border-bottom: windowtext 1pt solid; border-left: windowtext 1pt solid; border-right: windowtext 1pt solid; border-top: windowtext 1pt solid; padding-bottom: 1pt; padding-left: 4pt; padding-right: 4pt; padding-top: 1pt;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: &#39;courier new&#39;;&quot;&gt;protected&lt;/span&gt;&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; btnExportCSV_Click(&lt;span style=&quot;color: blue;&quot;&gt;object&lt;/span&gt; sender, &lt;span style=&quot;color: teal;&quot;&gt;EventArgs&lt;/span&gt; e)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.Clear();&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.Buffer = &lt;span style=&quot;color: blue;&quot;&gt;true&lt;/span&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.AddHeader(&lt;span style=&quot;color: maroon;&quot;&gt;&quot;content-disposition&quot;&lt;/span&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: maroon;&quot;&gt;&quot;attachment;filename=GridViewExport.csv&quot;&lt;/span&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.Charset = &lt;span style=&quot;color: maroon;&quot;&gt;&quot;&quot;&lt;/span&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.ContentType = &lt;span style=&quot;color: maroon;&quot;&gt;&quot;application/text&quot;&lt;/span&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; GridView1.AllowPaging = &lt;span style=&quot;color: blue;&quot;&gt;false&lt;/span&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; GridView1.DataBind(); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: teal;&quot;&gt;StringBuilder&lt;/span&gt; sb = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;StringBuilder&lt;/span&gt;();&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;for&lt;/span&gt; (&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt; k = 0; k &amp;lt; GridView1.Columns.Count; k++)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: green;&quot;&gt;//add separator&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sb.Append(GridView1.Columns[k].HeaderText + &lt;span style=&quot;color: maroon;&quot;&gt;&#39;,&#39;&lt;/span&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: green;&quot;&gt;//append new line&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sb.Append(&lt;span style=&quot;color: maroon;&quot;&gt;&quot;\r\n&quot;&lt;/span&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;for&lt;/span&gt; (&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt; i = 0; i &amp;lt; GridView1.Rows.Count; i++)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;for&lt;/span&gt; (&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt; k = 0; k &amp;lt; GridView1.Columns.Count; k++)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: green;&quot;&gt;//add separator&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sb.Append(GridView1.Rows[i].Cells[k].Text + &lt;span style=&quot;color: maroon;&quot;&gt;&#39;,&#39;&lt;/span&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: green;&quot;&gt;//append new line&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sb.Append(&lt;span style=&quot;color: maroon;&quot;&gt;&quot;\r\n&quot;&lt;/span&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.Output.Write(sb.ToString());&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.Flush();&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.End();&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 6pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
 &lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: arial,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;VB.Net&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;border-bottom: windowtext 1pt solid; border-left: windowtext 1pt solid; border-right: windowtext 1pt solid; border-top: windowtext 1pt solid; padding-bottom: 1pt; padding-left: 4pt; padding-right: 4pt; padding-top: 1pt;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: &#39;courier new&#39;;&quot;&gt;Protected&lt;/span&gt;&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;Sub&lt;/span&gt; btnExportCSV_Click(&lt;span style=&quot;color: blue;&quot;&gt;ByVal&lt;/span&gt; sender &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Object&lt;/span&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: &#39;courier new&#39;;&quot;&gt;ByVal&lt;/span&gt;&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt; e &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; EventArgs)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;Response.Clear()&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;Response.Buffer = &lt;span style=&quot;color: blue;&quot;&gt;True&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;Response.AddHeader(&lt;span style=&quot;color: maroon;&quot;&gt;&quot;content-disposition&quot;&lt;/span&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;attachment;filename=GridViewExport.csv&quot;&lt;/span&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;Response.Charset = &lt;span style=&quot;color: maroon;&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;Response.ContentType = &lt;span style=&quot;color: maroon;&quot;&gt;&quot;application/text&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;GridView1.AllowPaging = &lt;span style=&quot;color: blue;&quot;&gt;False&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;GridView1.DataBind()&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;Dim&lt;/span&gt; sb &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;New&lt;/span&gt; StringBuilder()&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;For&lt;/span&gt; k &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Integer&lt;/span&gt; = 0 &lt;span style=&quot;color: blue;&quot;&gt;To&lt;/span&gt; GridView1.Columns.Count - 1&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &lt;span style=&quot;color: green;&quot;&gt;&#39;add separator &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; sb.Append(GridView1.Columns(k).HeaderText + &quot;,&quot;c)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;Next&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&lt;span style=&quot;color: green;&quot;&gt;&#39;append new line &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;sb.Append(vbCr &amp;amp; vbLf)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;For&lt;/span&gt; i &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Integer&lt;/span&gt; = 0 &lt;span style=&quot;color: blue;&quot;&gt;To&lt;/span&gt; GridView1.Rows.Count - 1&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;For&lt;/span&gt; k &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Integer&lt;/span&gt; = 0 &lt;span style=&quot;color: blue;&quot;&gt;To&lt;/span&gt; GridView1.Columns.Count - 1&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: green;&quot;&gt;&#39;add separator &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; sb.Append(GridView1.Rows(i).Cells(k).Text + &quot;,&quot;c)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;Next&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; &lt;span style=&quot;color: green;&quot;&gt;&#39;append new line &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp; sb.Append(vbCr &amp;amp; vbLf)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;Next&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;Response.Output.Write(sb.ToString())&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;Response.Flush()&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;Response.End()&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 6pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: &#39;courier new&#39;;&quot;&gt;End&lt;/span&gt;&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;Sub&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;span style=&quot;font-family: arial,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;The Output Exported File&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;img alt=&quot;GridView data exported to CSV File&quot; src=&quot;http://www.aspsnippets.com/Handlers/DownloadFile.ashx?File=3f8c24ba-9462-4135-b352-3754df2d8c4d.PNG&quot; style=&quot;height: 550px; width: 594px;&quot; /&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;span style=&quot;font-family: arial,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;When you run the application first time and click export you might receive the following error&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;img alt=&quot;Error encountered when you click export&quot; src=&quot;http://www.aspsnippets.com/Handlers/DownloadFile.ashx?File=5b0e5b8c-b4b9-4e05-a26d-de93da96545f.PNG&quot; style=&quot;height: 448px; width: 594px;&quot; /&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;span style=&quot;font-family: arial,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;To avoid the error you will need to add this event which ensures that the GridView is Rendered before exporting.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&amp;nbsp;&amp;nbsp;
 &lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: arial,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;C#&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;border-bottom: windowtext 1pt solid; border-left: windowtext 1pt solid; border-right: windowtext 1pt solid; border-top: windowtext 1pt solid; padding-bottom: 1pt; padding-left: 4pt; padding-right: 4pt; padding-top: 1pt;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: &#39;courier new&#39;;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;override&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; VerifyRenderingInServerForm(&lt;span style=&quot;color: teal;&quot;&gt;Control&lt;/span&gt; control)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: green;&quot;&gt;/* Verifies that the control is rendered */&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 6pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: arial,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;VB.Net&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;border-bottom: windowtext 1pt solid; border-left: windowtext 1pt solid; border-right: windowtext 1pt solid; border-top: windowtext 1pt solid; padding-bottom: 1pt; padding-left: 4pt; padding-right: 4pt; padding-top: 1pt;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: &#39;courier new&#39;;&quot;&gt;Public&lt;/span&gt;&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;Overloads&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Overrides&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Sub&lt;/span&gt; VerifyRenderingInServerForm&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;(&lt;span style=&quot;color: blue;&quot;&gt;ByVal&lt;/span&gt; control &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; Control)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 0pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: green;&quot;&gt;&#39; Verifies that the control is rendered &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; margin: 0in 0in 6pt; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: &#39;courier new&#39;;&quot;&gt;End&lt;/span&gt;&lt;span style=&quot;font-family: &#39;courier new&#39;;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;Sub&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 6pt;&quot;&gt;
&lt;/div&gt;
&lt;span style=&quot;font-family: arial,sans-serif;&quot;&gt;&lt;/span&gt; &lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jigneshhirpara.blogspot.com/feeds/480451506029635437/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jigneshhirpara.blogspot.com/2012/05/exporting-to-word-excel-pdf-and-csv.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1603683968943160062/posts/default/480451506029635437'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1603683968943160062/posts/default/480451506029635437'/><link rel='alternate' type='text/html' href='http://jigneshhirpara.blogspot.com/2012/05/exporting-to-word-excel-pdf-and-csv.html' title='Exporting to Word, Excel ,pdf and CSV'/><author><name>Aspnet Blog</name><uri>http://www.blogger.com/profile/05026124318899904261</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='18' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjg8fG_htl_Ycu9RwdVNDUTFEN4pj2vQC5JIVWSSkzwEUWHtI_zAKWEX8AHcLhQYpVyCv_t7MzDw7CoNI1NBlagrrwvsinnwLe_a8wF8ZoTE0pNkfO1pytRog4b9RGpS_M/s220/226273_147861055282808_100001767425850_294367_7136963_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1603683968943160062.post-1043974315539753790</id><published>2012-04-09T06:19:00.004-07:00</published><updated>2012-04-09T06:24:40.712-07:00</updated><title type='text'>Currenct Convertor( Number to Word) Asp.Net (C#)</title><content type='html'>1) Indian Ruppess&lt;br /&gt;&lt;br /&gt;public string NumberToWord(Int32 number)&lt;br /&gt;      {&lt;br /&gt;&lt;br /&gt;          if (number == 0) return &quot;Zero&quot;;&lt;br /&gt;&lt;br /&gt;          //if (number == -2147483648) return &quot;Minus Two Hundred and Fourteen Crore Seventy Four Lakh Eighty Three Thousand Six Hundred and Forty Eight&quot;;&lt;br /&gt;&lt;br /&gt;          int[] num = new int[4];&lt;br /&gt;          int first = 0;&lt;br /&gt;          int u, h, t;&lt;br /&gt;&lt;br /&gt;          System.Text.StringBuilder sb = new System.Text.StringBuilder();&lt;br /&gt;&lt;br /&gt;          if (number &amp;lt; 0)&lt;br /&gt;          {&lt;br /&gt;&lt;br /&gt;              sb.Append(&quot;Minus &quot;);&lt;br /&gt;              number = -number;&lt;br /&gt;          }&lt;br /&gt;&lt;br /&gt;          string[] words0 = { &quot;&quot;, &quot;One &quot;, &quot;Two &quot;, &quot;Three &quot;, &quot;Four &quot;, &quot;Five &quot;, &quot;Six &quot;, &quot;Seven &quot;, &quot;Eight &quot;, &quot;Nine &quot; };&lt;br /&gt;&lt;br /&gt;          string[] words = { &quot;Ten &quot;, &quot;Eleven &quot;, &quot;Twelve &quot;, &quot;Thirteen &quot;, &quot;Fourteen &quot;, &quot;Fifteen &quot;, &quot;Sixteen &quot;, &quot;Seventeen &quot;, &quot;Eighteen &quot;, &quot;Nineteen &quot; };&lt;br /&gt;&lt;br /&gt;          string[] words2 = { &quot;Twenty &quot;, &quot;Thirty &quot;, &quot;Forty &quot;, &quot;Fifty &quot;, &quot;Sixty &quot;, &quot;Seventy &quot;, &quot;Eighty &quot;, &quot;Ninety &quot; };&lt;br /&gt;&lt;br /&gt;          string[] words3 = { &quot;Thousand &quot;, &quot;Lakh &quot;, &quot;Crore &quot; };&lt;br /&gt;        //   { &quot;&quot;, &quot;thousand&quot;, &quot;million&quot;, &quot;billion&quot;, &quot;trillion&quot;, &quot;quadrillion&quot;, &quot;quintillion&quot; };&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;          num[0] = number % 1000; // units&lt;br /&gt;&lt;br /&gt;          num[1] = number / 1000;&lt;br /&gt;&lt;br /&gt;          num[2] = number / 100000;&lt;br /&gt;&lt;br /&gt;          num[1] = num[1] - 100 * num[2];// thousands&lt;br /&gt;&lt;br /&gt;          num[3] = number / 10000000; // crores&lt;br /&gt;&lt;br /&gt;          num[2] = num[2] - 100 * num[3]; // lakhs&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;          for (int i = 3; i &amp;gt; 0; i--)&lt;br /&gt;          {&lt;br /&gt;              if (num[i] != 0)&lt;br /&gt;              {&lt;br /&gt;                  first = i;&lt;br /&gt;                  break;&lt;br /&gt;              }&lt;br /&gt;          }&lt;br /&gt;&lt;br /&gt;          for (int i = first; i &amp;gt;= 0; i--)&lt;br /&gt;          {&lt;br /&gt;&lt;br /&gt;              if (num[i] == 0) continue;&lt;br /&gt;&lt;br /&gt;              u = num[i] % 10; // ones&lt;br /&gt;&lt;br /&gt;              t = num[i] / 10;&lt;br /&gt;&lt;br /&gt;              h = num[i] / 100; // hundreds&lt;br /&gt;&lt;br /&gt;              t = t - 10 * h; // tens&lt;br /&gt;&lt;br /&gt;              if (h &amp;gt; 0) sb.Append(words0[h] + &quot;Hundred &quot;);&lt;br /&gt;&lt;br /&gt;              if (u &amp;gt; 0 || t &amp;gt; 0)&lt;br /&gt;              {&lt;br /&gt;&lt;br /&gt;                  if (h &amp;gt; 0 || i == 0) sb.Append(&quot;and &quot;);&lt;br /&gt;&lt;br /&gt;                  if (t == 0)&lt;br /&gt;&lt;br /&gt;                      sb.Append(words0[u]);&lt;br /&gt;&lt;br /&gt;                  else if (t == 1)&lt;br /&gt;&lt;br /&gt;                      sb.Append(words[u]);&lt;br /&gt;&lt;br /&gt;                  else&lt;br /&gt;&lt;br /&gt;                      sb.Append(words2[t - 2] + words0[u]);&lt;br /&gt;&lt;br /&gt;              }&lt;br /&gt;&lt;br /&gt;              if (i != 0) sb.Append(words3[i - 1]);&lt;br /&gt;&lt;br /&gt;          }&lt;br /&gt;&lt;br /&gt;          return sb.ToString().TrimEnd();&lt;br /&gt;&lt;br /&gt;      }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;2) Dollar and Euro&lt;br /&gt;&lt;br /&gt;public string NumberToWords(string rawnumber)&lt;br /&gt;      {&lt;br /&gt;          int inputNum = 0;&lt;br /&gt;          int dig1, dig2, dig3, level = 0, lasttwo, threeDigits;&lt;br /&gt;          string dollars, cents;&lt;br /&gt;          try&lt;br /&gt;          {&lt;br /&gt;              string[] Splits = new string[2];&lt;br /&gt;              Splits = rawnumber.Split(&#39;.&#39;);   //notice that it is &#39; and not &quot;&lt;br /&gt;              inputNum = Convert.ToInt32(Splits[0]);&lt;br /&gt;              dollars = &quot;&quot;;&lt;br /&gt;              cents = Splits[1];&lt;br /&gt;              if (cents.Length == 1)&lt;br /&gt;              {&lt;br /&gt;                  cents += &quot;0&quot;;   // 12.5 is twelve and 50/100, not twelve and 5/100&lt;br /&gt;              }&lt;br /&gt;          }&lt;br /&gt;          catch&lt;br /&gt;          {&lt;br /&gt;              cents = &quot;00&quot;;&lt;br /&gt;              inputNum = Convert.ToInt32(rawnumber);&lt;br /&gt;              dollars = &quot;&quot;;&lt;br /&gt;          }&lt;br /&gt;&lt;br /&gt;          string x = &quot;&quot;;&lt;br /&gt;&lt;br /&gt;          //they had zero for ones and tens but that gave ninety zero for 90&lt;br /&gt;          string[] ones = { &quot;&quot;, &quot;One&quot;, &quot;Two&quot;, &quot;Three&quot;, &quot;Four&quot;, &quot;Five&quot;, &quot;Six&quot;, &quot;Seven&quot;, &quot;Eight&quot;, &quot;Nine&quot;, &quot;Ten&quot;, &quot;Eleven&quot;, &quot;Twelve&quot;, &quot;Thirteen&quot;, &quot;Fourteen&quot;, &quot;Fifteen&quot;, &quot;Sixteen&quot;, &quot;Seventeen&quot;, &quot;Eighteen&quot;, &quot;Nineteen&quot; };&lt;br /&gt;          string[] tens = { &quot;&quot;, &quot;Ten&quot;, &quot;Twenty&quot;, &quot;Thirty&quot;, &quot;Forty&quot;, &quot;Fifty&quot;, &quot;Sixty&quot;, &quot;Seventy&quot;, &quot;Eighty&quot;, &quot;Ninety&quot; };&lt;br /&gt;          string[] thou = { &quot;&quot;, &quot;Thousand&quot;, &quot;Million&quot;, &quot;Billion&quot;, &quot;Trillion&quot;, &quot;Quadrillion&quot;, &quot;Quintillion&quot; };&lt;br /&gt;&lt;br /&gt;          bool isNegative = false;&lt;br /&gt;          if (inputNum &amp;lt; 0)&lt;br /&gt;          {&lt;br /&gt;              isNegative = true;&lt;br /&gt;              inputNum *= -1;&lt;br /&gt;          }&lt;br /&gt;          if (inputNum == 0)&lt;br /&gt;          {&lt;br /&gt;              //return &quot;zero and &quot; + cents + &quot;/100&quot;;&lt;br /&gt;              return &quot;zero&quot;;&lt;br /&gt;          }&lt;br /&gt;&lt;br /&gt;          string s = inputNum.ToString();&lt;br /&gt;&lt;br /&gt;          while (s.Length &amp;gt; 0)&lt;br /&gt;          {&lt;br /&gt;              //Get the three rightmost characters&lt;br /&gt;              x = (s.Length &amp;lt; 3) ? s : s.Substring(s.Length - 3, 3);&lt;br /&gt;&lt;br /&gt;              // Separate the three digits&lt;br /&gt;              threeDigits = int.Parse(x);&lt;br /&gt;              lasttwo = threeDigits % 100;&lt;br /&gt;              dig1 = threeDigits / 100;&lt;br /&gt;              dig2 = lasttwo / 10;&lt;br /&gt;              dig3 = (threeDigits % 10);&lt;br /&gt;&lt;br /&gt;              // append a &quot;thousand&quot; where appropriate&lt;br /&gt;              if (level &amp;gt; 0 &amp;amp;&amp;amp; dig1 + dig2 + dig3 &amp;gt; 0)&lt;br /&gt;              {&lt;br /&gt;                  dollars = thou[level] + &quot; &quot; + dollars;&lt;br /&gt;                  dollars = dollars.Trim();&lt;br /&gt;              }&lt;br /&gt;&lt;br /&gt;              // check that the last two digits is not a zero&lt;br /&gt;              if (lasttwo &amp;gt; 0)&lt;br /&gt;              {&lt;br /&gt;                  if (lasttwo &amp;lt; 20)&lt;br /&gt;                  {&lt;br /&gt;                      // if less than 20, use &quot;ones&quot; only&lt;br /&gt;                      dollars = ones[lasttwo] + &quot; &quot; + dollars;&lt;br /&gt;                  }&lt;br /&gt;                  else&lt;br /&gt;                  {&lt;br /&gt;                      // otherwise, use both &quot;tens&quot; and &quot;ones&quot; array&lt;br /&gt;                      dollars = tens[dig2] + &quot; &quot; + ones[dig3] + &quot; &quot; + dollars;&lt;br /&gt;                  }&lt;br /&gt;                  if (s.Length &amp;lt; 3)&lt;br /&gt;                  {&lt;br /&gt;                      if (isNegative) { dollars = &quot;negative &quot; + dollars; }&lt;br /&gt;                      //return dollars + &quot; and &quot; + cents + &quot;/100&quot;;&lt;br /&gt;                      return dollars ;&lt;br /&gt;                  }&lt;br /&gt;              }&lt;br /&gt;&lt;br /&gt;              // if a hundreds part is there, translate it&lt;br /&gt;              if (dig1 &amp;gt; 0)&lt;br /&gt;              {&lt;br /&gt;                  dollars = ones[dig1] + &quot; hundred &quot; + dollars;&lt;br /&gt;                  s = (s.Length - 3) &amp;gt; 0 ? s.Substring(0, s.Length - 3) : &quot;&quot;;&lt;br /&gt;                  level++;&lt;br /&gt;              }&lt;br /&gt;              else&lt;br /&gt;              {&lt;br /&gt;                  if (s.Length &amp;gt; 3)&lt;br /&gt;                  {&lt;br /&gt;                      s = s.Substring(0, s.Length - 3);&lt;br /&gt;                      level++;&lt;br /&gt;                  }&lt;br /&gt;              }&lt;br /&gt;          }&lt;br /&gt;&lt;br /&gt;          if (isNegative) { dollars = &quot;negative &quot; + dollars; }&lt;br /&gt;          //return dollars + &quot; and &quot; + cents + &quot;/100&quot;;&lt;br /&gt;          return dollars ;&lt;br /&gt;&lt;br /&gt;      }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Using Stored Procedure(Sql Server)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Create Procedure NumberToWord&lt;br /&gt;@Number AS BIGINT&lt;br /&gt;AS&lt;br /&gt;BEGIN&lt;br /&gt;DECLARE @Digits INT&lt;br /&gt;SET @Digits = @Number&lt;br /&gt;IF (LEN(@Digits) &amp;gt; 4)&lt;br /&gt;BEGIN&lt;br /&gt;RAISERROR (&#39;PLEASE ENTER WITH IN 4 DIGIT NUMBERS&#39;,12,-1)&lt;br /&gt;END&lt;br /&gt;ELSE IF (LEN(@Digits) &amp;lt;= 4)&lt;br /&gt;BEGIN&lt;br /&gt;DECLARE @NumWords TABLE(Number INT, Ones VARCHAR(15), Tens VARCHAR(15), Hundreds VARCHAR(15), Thousands VARCHAR(15))&lt;br /&gt;INSERT INTO @NumWords&lt;br /&gt;SELECT 0,&#39;&#39;,&#39;&#39;,&#39;&#39;,&#39;&#39; UNION ALL&lt;br /&gt;SELECT 1,&#39;ONE&#39;,&#39;TEN&#39;,&#39;ONE HUNDRED&#39;,&#39;ONE THOUSAND&#39; UNION ALL&lt;br /&gt;SELECT 2,&#39;TWO&#39;,&#39;TWENTY&#39;,&#39;TWO HUNDRED&#39;,&#39;TWO THOUSAND&#39; UNION ALL&lt;br /&gt;SELECT 3,&#39;THREE&#39;,&#39;THIRTY&#39;,&#39;THREE HUNDRED&#39;,&#39;THREE THOUSAND&#39; UNION ALL&lt;br /&gt;SELECT 4,&#39;FOUR&#39;,&#39;FORTY&#39;,&#39;FOUR HUNDRED&#39;,&#39;FOUR THOUSAND&#39; UNION ALL&lt;br /&gt;SELECT 5,&#39;FIVE&#39;,&#39;FIFTY&#39;,&#39;FIVE HUNDRED&#39;,&#39;FIVE THOUSAND&#39; UNION ALL&lt;br /&gt;SELECT 6,&#39;SIX&#39;,&#39;SIXTY&#39;,&#39;SIX HUNDRED&#39;,&#39;SIX THOUSAND&#39; UNION ALL&lt;br /&gt;SELECT 7,&#39;SEVEN&#39;,&#39;SEVENTY&#39;,&#39;SEVEN HUNDRED&#39;,&#39;SEVEN THOUSAND&#39; UNION ALL&lt;br /&gt;SELECT 8,&#39;EIGHT&#39;,&#39;EIGHTY&#39;,&#39;EIGHT HUNDRED&#39;,&#39;EIGHT THOUSAND&#39; UNION ALL&lt;br /&gt;SELECT 9,&#39;NINE&#39;,&#39;NINETY&#39;,&#39;NINE HUNDRED&#39;,&#39;NINETHOUSAND&#39; UNION ALL&lt;br /&gt;SELECT 10,&#39;NINETEEN&#39;,&#39;&#39;,&#39;&#39;,&#39;&#39; UNION ALL&lt;br /&gt;SELECT 11,&#39;ELEVEN&#39;,&#39;&#39;,&#39;&#39;,&#39;&#39; UNION ALL&lt;br /&gt;SELECT 12,&#39;TWELVE&#39;,&#39;&#39;,&#39;&#39;,&#39;&#39; UNION ALL&lt;br /&gt;SELECT 13,&#39;THIRTEEN&#39;,&#39;&#39;,&#39;&#39;,&#39;&#39; UNION ALL&lt;br /&gt;SELECT 14,&#39;FOURTEEN&#39;,&#39;&#39;,&#39;&#39;,&#39;&#39; UNION ALL&lt;br /&gt;SELECT 15,&#39;FIFTEEN&#39;,&#39;&#39;,&#39;&#39;,&#39;&#39; UNION ALL&lt;br /&gt;SELECT 16,&#39;SIXTEEN&#39;,&#39;&#39;,&#39;&#39;,&#39;&#39; UNION ALL&lt;br /&gt;SELECT 17,&#39;SEVENTEEN&#39;,&#39;&#39;,&#39;&#39;,&#39;&#39; UNION ALL&lt;br /&gt;SELECT 18,&#39;EIGHTEEN&#39;,&#39;&#39;,&#39;&#39;,&#39;&#39; UNION ALL&lt;br /&gt;SELECT 19,&#39;NINETEEN&#39;,&#39;&#39;,&#39;&#39;,&#39;&#39;&lt;br /&gt;SELECT RTRIM(MAX(CASE WHEN NUMBER = SUBSTRING(REVERSE(@Digits),4,1) THEN THOUSANDS ELSE &#39;&#39; END)) --FROM @NumWords&lt;br /&gt;+SPACE(2)+ LTRIM(MAX(CASE WHEN NUMBER = SUBSTRING(REVERSE(@Digits),3,1) THEN HUNDREDS ELSE &#39;&#39; END) )&lt;br /&gt;+SPACE(2)+ MAX(CASE WHEN RIGHT(@Digits,2) NOT BETWEEN 11 AND 19 AND NUMBER = SUBSTRING(REVERSE(@Digits),2,1) THEN TENS ELSE &#39;&#39; END)&lt;br /&gt;+SPACE(2)+ MAX(CASE WHEN RIGHT(@Digits,2) NOT BETWEEN 11 AND 19 AND NUMBER = RIGHT(@Digits,1) THEN ONES&lt;br /&gt;WHEN RIGHT(@Digits,2) BETWEEN 11 AND 19 AND NUMBER = RIGHT(@Digits,2) THEN ONES ELSE &#39;&#39; END)&lt;br /&gt;As &quot;Number to Words&quot;&lt;br /&gt;FROM @NUMWORDS&lt;br /&gt;END&lt;br /&gt;END&lt;br /&gt;--EXEC NumberToWord 2010</content><link rel='replies' type='application/atom+xml' href='http://jigneshhirpara.blogspot.com/feeds/1043974315539753790/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jigneshhirpara.blogspot.com/2012/04/currenct-convertor-number-to-word.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1603683968943160062/posts/default/1043974315539753790'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1603683968943160062/posts/default/1043974315539753790'/><link rel='alternate' type='text/html' href='http://jigneshhirpara.blogspot.com/2012/04/currenct-convertor-number-to-word.html' title='Currenct Convertor( Number to Word) Asp.Net (C#)'/><author><name>Aspnet Blog</name><uri>http://www.blogger.com/profile/05026124318899904261</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='18' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjg8fG_htl_Ycu9RwdVNDUTFEN4pj2vQC5JIVWSSkzwEUWHtI_zAKWEX8AHcLhQYpVyCv_t7MzDw7CoNI1NBlagrrwvsinnwLe_a8wF8ZoTE0pNkfO1pytRog4b9RGpS_M/s220/226273_147861055282808_100001767425850_294367_7136963_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1603683968943160062.post-7020875850206606766</id><published>2011-11-25T01:04:00.001-08:00</published><updated>2011-11-25T01:15:54.285-08:00</updated><title type='text'>Displaying multiple records in one row</title><content type='html'>&lt;p class=&quot;MsoNoSpacing&quot;&gt;I have a table with values as follows:&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span style=&quot;font-size:8.5pt;font-family:Consolas; color:#3C2878&quot;&gt;SQL&amp;gt; SELECT deptno, ename FROM emp ORDER BY deptno, ename;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span style=&quot;font-size:8.5pt;font-family:Consolas; color:#3C2878&quot;&gt;DEPTNO ENAME&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span style=&quot;font-size:8.5pt;font-family:Consolas; color:#3C2878&quot;&gt;------ ----------&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span style=&quot;font-size:8.5pt;font-family:Consolas; color:#3C2878&quot;&gt;    10 CLARK&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span style=&quot;font-size:8.5pt;font-family:Consolas; color:#3C2878&quot;&gt;    10 KING&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span style=&quot;font-size:8.5pt;font-family:Consolas; color:#3C2878&quot;&gt;    10 MILLER&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span style=&quot;font-size:8.5pt;font-family:Consolas; color:#3C2878&quot;&gt;    20 ADAMS&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span style=&quot;font-size:8.5pt;font-family:Consolas; color:#3C2878&quot;&gt;    20 FORD&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span style=&quot;font-size:8.5pt;font-family:Consolas; color:#3C2878&quot;&gt;    20 JONES&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span style=&quot;font-size:8.5pt;font-family:Consolas; color:#3C2878&quot;&gt;    20 SCOTT&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span style=&quot;font-size:8.5pt;font-family:Consolas; color:#3C2878&quot;&gt;    20 SMITH&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span style=&quot;font-size:8.5pt;font-family:Consolas; color:#3C2878&quot;&gt;    30 ALLEN&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span style=&quot;font-size:8.5pt;font-family:Consolas; color:#3C2878&quot;&gt;    30 BLAKE&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span style=&quot;font-size:8.5pt;font-family:Consolas; color:#3C2878&quot;&gt;    30 JAMES&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span style=&quot;font-size:8.5pt;font-family:Consolas; color:#3C2878&quot;&gt;    30 MARTIN&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span style=&quot;font-size:8.5pt;font-family:Consolas; color:#3C2878&quot;&gt;    30 TURNER&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span style=&quot;font-size:8.5pt;font-family:Consolas; color:#3C2878&quot;&gt;    30 WARD&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span style=&quot;font-size:8.5pt;font-family:Consolas; color:#3C2878&quot;&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span style=&quot;font-size:8.5pt;font-family:Consolas; color:#3C2878&quot;&gt;14 rows selected.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;but I need them in the following less convenient format:&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span style=&quot;font-size:8.5pt;font-family:Consolas; color:#3C2878&quot;&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span style=&quot;font-size:8.5pt;font-family:Consolas; color:#3C2878&quot;&gt;DEPTNO ENAME&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span style=&quot;font-size:8.5pt;font-family:Consolas; color:#3C2878&quot;&gt;------ -----------------------------------------&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span style=&quot;font-size:8.5pt;font-family:Consolas; color:#3C2878&quot;&gt;    10 CLARK, KING, MILLER&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span style=&quot;font-size:8.5pt;font-family:Consolas; color:#3C2878&quot;&gt;    20 ADAMS, FORD, JONES, SCOTT, SMITH&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span style=&quot;font-size:8.5pt;font-family:Consolas; color:#3C2878&quot;&gt;    30 ALLEN, BLAKE, JAMES, MARTIN, TURNER, WARD&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;The following example illustrates the technique using the SCOTT demo table &quot;emp&quot;:&lt;a href=&quot;http://www.williamrobertson.net/documents/one_row.html&quot;&gt;&lt;sup&gt;&lt;span style=&quot;font-size:7.5pt;font-family:&amp;quot;Trebuchet MS&amp;quot;,&amp;quot;sans-serif&amp;quot;;color:#705050; background:yellow&quot;&gt;2&lt;/span&gt;&lt;/sup&gt;&lt;/a&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span style=&quot;font-size:9.0pt;font-family:Consolas; color:#202060&quot;&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span style=&quot;font-size:9.0pt;font-family:Consolas; color:#202060&quot;&gt;SELECT deptno &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span style=&quot;font-size:9.0pt;font-family:Consolas; color:#202060&quot;&gt;     , LTRIM(SYS_CONNECT_BY_PATH(ename,&#39;,&#39;))&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span style=&quot;font-size:9.0pt;font-family:Consolas; color:#202060&quot;&gt;FROM   ( SELECT deptno, ename&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span style=&quot;font-size:9.0pt;font-family:Consolas; color:#202060&quot;&gt;              , ROW_NUMBER() OVER (PARTITION BY deptno ORDER BY ename) -1 AS seq &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span style=&quot;font-size:9.0pt;font-family:Consolas; color:#202060&quot;&gt;         FROM   emp ) &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span style=&quot;font-size:9.0pt;font-family:Consolas; color:#202060&quot;&gt;WHERE  connect_by_isleaf = 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span style=&quot;font-size:9.0pt;font-family:Consolas; color:#202060&quot;&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span style=&quot;font-size:9.0pt;font-family:Consolas; color:#202060&quot;&gt;CONNECT BY seq = PRIOR seq +1 AND deptno = PRIOR deptno &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span style=&quot;font-size:9.0pt;font-family:Consolas; color:#202060&quot;&gt;START WITH seq = 1;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span style=&quot;font-size:9.0pt;font-family:Consolas; color:#202060&quot;&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span class=&quot;highlight&quot;&gt;&lt;span style=&quot;font-size:9.0pt; font-family:Consolas;color:#556EB4&quot;&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span class=&quot;highlight&quot;&gt;&lt;span style=&quot;font-size:9.0pt; font-family:Consolas;color:#556EB4&quot;&gt;    DEPTNO CONCATENATED&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span class=&quot;highlight&quot;&gt;&lt;span style=&quot;font-size:9.0pt; font-family:Consolas;color:#556EB4&quot;&gt;---------- --------------------------------------------------&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span class=&quot;highlight&quot;&gt;&lt;span style=&quot;font-size:9.0pt; font-family:Consolas;color:#556EB4&quot;&gt;        10 CLARK,KING,MILLER&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span class=&quot;highlight&quot;&gt;&lt;span style=&quot;font-size:9.0pt; font-family:Consolas;color:#556EB4&quot;&gt;        20 ADAMS,FORD,JONES,SCOTT,SMITH&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span class=&quot;highlight&quot;&gt;&lt;span style=&quot;font-size:9.0pt; font-family:Consolas;color:#556EB4&quot;&gt;        30 ALLEN,BLAKE,JAMES,MARTIN,TURNER,WARD&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span class=&quot;highlight&quot;&gt;&lt;span style=&quot;font-size:9.0pt; font-family:Consolas;color:#556EB4&quot;&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span class=&quot;highlight&quot;&gt;&lt;span style=&quot;font-size:9.0pt; font-family:Consolas;color:#556EB4&quot;&gt;3 rows selected.&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size:9.0pt;font-family:Consolas;color:#202060&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot; style=&quot;text-align: -webkit-auto; &quot;&gt;Another approach involves harnessing the dark power of XML:&lt;a href=&quot;http://www.williamrobertson.net/documents/one_row.html&quot;&gt;&lt;sup&gt;&lt;span style=&quot;font-size:7.5pt;font-family:&amp;quot;Trebuchet MS&amp;quot;,&amp;quot;sans-serif&amp;quot;;color:#705050; background:yellow&quot;&gt;3&lt;/span&gt;&lt;/sup&gt;&lt;/a&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span style=&quot;font-size:9.0pt;font-family:Consolas; color:#202060&quot;&gt;SELECT deptno&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span style=&quot;font-size:9.0pt;font-family:Consolas; color:#202060&quot;&gt;     , RTRIM&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span style=&quot;font-size:9.0pt;font-family:Consolas; color:#202060&quot;&gt;       ( xmlagg (xmlelement (c, ename || &#39;,&#39;) order by ename).extract (&#39;//text()&#39;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span style=&quot;font-size:9.0pt;font-family:Consolas; color:#202060&quot;&gt;       , &#39;,&#39; ) AS concatenated&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span style=&quot;font-size:9.0pt;font-family:Consolas; color:#202060&quot;&gt;FROM   emp&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span style=&quot;font-size:9.0pt;font-family:Consolas; color:#202060&quot;&gt;GROUP BY deptno;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span style=&quot;font-size:9.0pt;font-family:Consolas; color:#202060&quot;&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span class=&quot;highlight&quot;&gt;&lt;span style=&quot;font-size:9.0pt; font-family:Consolas;color:#556EB4&quot;&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span style=&quot;font-size:9.0pt;font-family:Consolas; color:#202060&quot;&gt;    DEPTNO CONCATENATED&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span style=&quot;font-size:9.0pt;font-family:Consolas; color:#202060&quot;&gt;---------- ---------------------------------------------------------------&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span style=&quot;font-size:9.0pt;font-family:Consolas; color:#202060&quot;&gt;        10 CLARK,KING,MILLER&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span style=&quot;font-size:9.0pt;font-family:Consolas; color:#202060&quot;&gt;        20 ADAMS,FORD,JONES,SCOTT,SMITH&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span style=&quot;font-size:9.0pt;font-family:Consolas; color:#202060&quot;&gt;        30 ALLEN,BLAKE,JAMES,MARTIN,TURNER,WARD&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span style=&quot;font-size:9.0pt;font-family:Consolas; color:#202060&quot;&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;span class=&quot;highlight&quot;&gt;3 rows selected.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNoSpacing&quot;&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://jigneshhirpara.blogspot.com/feeds/7020875850206606766/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jigneshhirpara.blogspot.com/2011/11/displaying-multiple-records-in-one-row.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1603683968943160062/posts/default/7020875850206606766'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1603683968943160062/posts/default/7020875850206606766'/><link rel='alternate' type='text/html' href='http://jigneshhirpara.blogspot.com/2011/11/displaying-multiple-records-in-one-row.html' title='Displaying multiple records in one row'/><author><name>Aspnet Blog</name><uri>http://www.blogger.com/profile/05026124318899904261</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='18' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjg8fG_htl_Ycu9RwdVNDUTFEN4pj2vQC5JIVWSSkzwEUWHtI_zAKWEX8AHcLhQYpVyCv_t7MzDw7CoNI1NBlagrrwvsinnwLe_a8wF8ZoTE0pNkfO1pytRog4b9RGpS_M/s220/226273_147861055282808_100001767425850_294367_7136963_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1603683968943160062.post-3458651774586999451</id><published>2011-11-11T22:15:00.000-08:00</published><updated>2011-11-11T22:23:45.807-08:00</updated><title type='text'>Differnce between .NET FrameWork</title><content type='html'>&lt;div&gt;&lt;b&gt;.NET FrameWork 2. 0 Features:&lt;/b&gt;&lt;/div&gt;&lt;div&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;Generics&lt;/div&gt;&lt;div&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;Anonymous methods&lt;/div&gt;&lt;div&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;Partial class&lt;/div&gt;&lt;div&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;Nullable type&lt;/div&gt;&lt;div&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;The new API gives a fine grain control on the behavior of the runtime with regards to multithreading, memory allocation, assembly loading and more&lt;/div&gt;&lt;div&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;Full 64-bit support for both the x64 and the IA64 hardware platforms&lt;/div&gt;&lt;div&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;New personalization features for ASP.NET, such as support for themes, skins and webparts.&lt;/div&gt;&lt;div&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;.NET Micro Framework&lt;/div&gt;&lt;div&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;Data Tables&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;.NET Framework 3.0 Features:&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;Also called WinFX,includes a new set of managed code APIs that are an integral part of Windows Vista and Windows Server 2008 operating systems and provides&lt;/div&gt;&lt;div&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;Windows Communication Foundation (WCF) – formerly called Indigo; a service-oriented messaging system which allows programs to interoperate locally or remotely similar to web services&lt;/div&gt;&lt;div&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;Windows Presentation Foundation (WPF) -  formerly called Avalon; a new user interface subsystem and API based on XML and vector graphics, which uses 3D computer graphics hardware and Direct3D technologies.&lt;/div&gt;&lt;div&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;Windows Workflow Foundation (WF) allows for building of task automation and integrated transactions using workflows.&lt;/div&gt;&lt;div&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;Windows CardSpace, formerly called InfoCard; a software component which securely stores a person’s digital identities and provides a unified interface for choosing the identity for a particular transaction, such as logging in to a website&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;.NET Framework 3.5 Features:&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;Language Integrated Query (LINQ)  for SQL, XML, Dataset, Object&lt;/div&gt;&lt;div&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;Addin system&lt;/div&gt;&lt;div&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;p2p base class&lt;/div&gt;&lt;div&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;Active directory&lt;/div&gt;&lt;div&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;ASP.NET Ajax&lt;/div&gt;&lt;div&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;Anonymous types with static type inference&lt;/div&gt;&lt;div&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;Paging support for ADO.NET&lt;/div&gt;&lt;div&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;ADO.NET synchronization API to synchronize local caches and server side data stores&lt;/div&gt;&lt;div&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;Asynchronous network I/O API&lt;/div&gt;&lt;div&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;Support for HTTP pipelining and syndication feeds.&lt;/div&gt;&lt;div&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;New System.CodeDom namespace&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;.NET Framework 4.0 Features:&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;Common Language Runtime (CLR)  – The following sections describe new features in security, parallel computing, performance and diagnostics, dynamic language runtime, and other CLR-related technologies&lt;/div&gt;&lt;div&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;Base Class Libraries&lt;/div&gt;&lt;div&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;Networking  – Enhancements have been made that affect how integrated Windows authentication is handled by the HttpWebRequest, HttpListener, SmtpClient, SslStream, NegotiateStream, and related classes in the System.Net and related namespaces&lt;/div&gt;&lt;div&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;Web  – The following sections describe new features in ASP.NET core services, Web Forms, Dynamic Data, and Visual Web Developer.&lt;/div&gt;&lt;div&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;Client  – The following sections describe new features in Windows Presentation Foundation (WPF) and Managed Extensibility Framework (MEF).&lt;/div&gt;&lt;div&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;Data&lt;/div&gt;&lt;div&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;Communications  – Windows Communication Foundation (WCF) provides the new features and enhancements described in the following sections.&lt;/div&gt;&lt;div&gt;•&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;Workflow – Windows Workflow Foundation (WF) in .NET Framework 4.0 changes several development paradigms from earlier versions. Workflows are now easier to create, execute, and maintain.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jigneshhirpara.blogspot.com/feeds/3458651774586999451/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jigneshhirpara.blogspot.com/2011/11/differnce-between-net-framework.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1603683968943160062/posts/default/3458651774586999451'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1603683968943160062/posts/default/3458651774586999451'/><link rel='alternate' type='text/html' href='http://jigneshhirpara.blogspot.com/2011/11/differnce-between-net-framework.html' title='Differnce between .NET FrameWork'/><author><name>Aspnet Blog</name><uri>http://www.blogger.com/profile/05026124318899904261</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='18' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjg8fG_htl_Ycu9RwdVNDUTFEN4pj2vQC5JIVWSSkzwEUWHtI_zAKWEX8AHcLhQYpVyCv_t7MzDw7CoNI1NBlagrrwvsinnwLe_a8wF8ZoTE0pNkfO1pytRog4b9RGpS_M/s220/226273_147861055282808_100001767425850_294367_7136963_n.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1603683968943160062.post-7067859339607103036</id><published>2011-05-15T21:02:00.001-07:00</published><updated>2011-05-15T21:02:28.097-07:00</updated><title type='text'>data layer</title><content type='html'>&lt;div&gt; public Boolean ExecuteS1p(DataBO dbo)&lt;/div&gt;&lt;div&gt;    {&lt;/div&gt;&lt;div&gt;        Boolean flag = false;&lt;/div&gt;&lt;div&gt;        DataConnection DC = new DataConnection(ConnString);&lt;/div&gt;&lt;div&gt;        try&lt;/div&gt;&lt;div&gt;        {&lt;/div&gt;&lt;div&gt;            DC.OpenConnection();&lt;/div&gt;&lt;div&gt;            DC.BegingTran();&lt;/div&gt;&lt;div&gt;            DC.AppCommand.CommandType = CommandType.StoredProcedure;&lt;/div&gt;&lt;div&gt;            DC.AppCommand.CommandText = &quot;Sp_AppUsere1&quot;;&lt;/div&gt;&lt;div&gt;            DC.AppCommand.Parameters.AddWithValue(&quot;@ActionID&quot;, dbo.ActionID1 );&lt;/div&gt;&lt;div&gt;            DC.AppCommand.Parameters.AddWithValue(&quot;@Aref&quot;, dbo.Aref);&lt;/div&gt;&lt;div&gt;            DC.AppCommand.Parameters.AddWithValue(&quot;@UserID&quot;, dbo.USerID1 );&lt;/div&gt;&lt;div&gt;            DC.AppCommand.Parameters.AddWithValue(&quot;@Password&quot;, dbo.Password);&lt;/div&gt;&lt;div&gt;            DC.AppCommand.Parameters.AddWithValue(&quot;@FirstName&quot;, dbo.FirstName );&lt;/div&gt;&lt;div&gt;            DC.AppCommand.Parameters.AddWithValue(&quot;@LastName&quot;, dbo.LastName );&lt;/div&gt;&lt;div&gt;            DC.AppCommand.Parameters.AddWithValue(&quot;@ImageData&quot;,dbo.Imagedata);&lt;/div&gt;&lt;div&gt;            DC.AppDataAdapter.SelectCommand = DC.AppCommand;&lt;/div&gt;&lt;div&gt;            DC.AppDataAdapter.Fill(DC.AppDataSet);&lt;/div&gt;&lt;div&gt;            DC.CommitTran();&lt;/div&gt;&lt;div&gt;            flag = true;&lt;/div&gt;&lt;div&gt;        }&lt;/div&gt;&lt;div&gt;        catch&lt;/div&gt;&lt;div&gt;        {&lt;/div&gt;&lt;div&gt;            DC.RollBackTran();&lt;/div&gt;&lt;div&gt;            throw;&lt;/div&gt;&lt;div&gt;        }&lt;/div&gt;&lt;div&gt;        finally&lt;/div&gt;&lt;div&gt;        {&lt;/div&gt;&lt;div&gt;            DC.closeConnction();&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;        }&lt;/div&gt;&lt;div&gt;        return flag;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jigneshhirpara.blogspot.com/feeds/7067859339607103036/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jigneshhirpara.blogspot.com/2011/05/data-layer.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1603683968943160062/posts/default/7067859339607103036'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1603683968943160062/posts/default/7067859339607103036'/><link rel='alternate' type='text/html' href='http://jigneshhirpara.blogspot.com/2011/05/data-layer.html' title='data layer'/><author><name>Aspnet Blog</name><uri>http://www.blogger.com/profile/05026124318899904261</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='18' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjg8fG_htl_Ycu9RwdVNDUTFEN4pj2vQC5JIVWSSkzwEUWHtI_zAKWEX8AHcLhQYpVyCv_t7MzDw7CoNI1NBlagrrwvsinnwLe_a8wF8ZoTE0pNkfO1pytRog4b9RGpS_M/s220/226273_147861055282808_100001767425850_294367_7136963_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1603683968943160062.post-5490348433194740377</id><published>2011-05-15T20:50:00.000-07:00</published><updated>2011-05-15T20:54:11.901-07:00</updated><title type='text'>Regural Expression</title><content type='html'>&lt;div&gt;Pincode:&lt;/div&gt;&lt;div&gt;&quot;\d{5}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;Fro Number Only:&lt;div&gt;&quot;^[0-9]+$&quot;&lt;/div&gt;&lt;div&gt;Fro Date :mm/dd/yyyy  or mm.dd.yyyy  or mm-dd-yyyy &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&quot;(0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.](19|20)\d\d&quot;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jigneshhirpara.blogspot.com/feeds/5490348433194740377/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jigneshhirpara.blogspot.com/2011/05/regural-expression.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1603683968943160062/posts/default/5490348433194740377'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1603683968943160062/posts/default/5490348433194740377'/><link rel='alternate' type='text/html' href='http://jigneshhirpara.blogspot.com/2011/05/regural-expression.html' title='Regural Expression'/><author><name>Aspnet Blog</name><uri>http://www.blogger.com/profile/05026124318899904261</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='18' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjg8fG_htl_Ycu9RwdVNDUTFEN4pj2vQC5JIVWSSkzwEUWHtI_zAKWEX8AHcLhQYpVyCv_t7MzDw7CoNI1NBlagrrwvsinnwLe_a8wF8ZoTE0pNkfO1pytRog4b9RGpS_M/s220/226273_147861055282808_100001767425850_294367_7136963_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1603683968943160062.post-6344935232038590773</id><published>2011-05-15T20:49:00.001-07:00</published><updated>2011-05-15T20:50:35.005-07:00</updated><title type='text'>how to stored Images</title><content type='html'>&lt;div&gt;stored&lt;/div&gt;byte[] imageBytes =(byte[]) Session[&quot;imgData&quot;];&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;display &lt;/div&gt;&lt;div&gt;imageBytes = ((byte[])Session[&quot;imgData&quot;]);&lt;/div&gt;&lt;div&gt;            Response.BinaryWrite(imageBytes);&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jigneshhirpara.blogspot.com/feeds/6344935232038590773/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jigneshhirpara.blogspot.com/2011/05/how-to-stored-images.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1603683968943160062/posts/default/6344935232038590773'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1603683968943160062/posts/default/6344935232038590773'/><link rel='alternate' type='text/html' href='http://jigneshhirpara.blogspot.com/2011/05/how-to-stored-images.html' title='how to stored Images'/><author><name>Aspnet Blog</name><uri>http://www.blogger.com/profile/05026124318899904261</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='18' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjg8fG_htl_Ycu9RwdVNDUTFEN4pj2vQC5JIVWSSkzwEUWHtI_zAKWEX8AHcLhQYpVyCv_t7MzDw7CoNI1NBlagrrwvsinnwLe_a8wF8ZoTE0pNkfO1pytRog4b9RGpS_M/s220/226273_147861055282808_100001767425850_294367_7136963_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1603683968943160062.post-296195154017494711</id><published>2011-05-15T20:40:00.001-07:00</published><updated>2011-05-15T20:40:55.970-07:00</updated><title type='text'>Inline Editing</title><content type='html'>&lt;div&gt;    protected void GVEmployee_RowUpdating(object sender, GridViewUpdateEventArgs e)&lt;/div&gt;&lt;div&gt;    {&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;        GridViewRow row;&lt;/div&gt;&lt;div&gt;        row = GVEmployee.Rows[e.RowIndex];&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;        Label Emp_code = row.FindControl(&quot;lblEMP_Code&quot;) as Label;&lt;/div&gt;&lt;div&gt;        DropDownList  Dept_Code= row.FindControl(&quot;DDLemp_CODE&quot;) as DropDownList;&lt;/div&gt;&lt;div&gt;        TextBox Emp_Name = row.FindControl(&quot;txtIEmpName&quot;) as TextBox;&lt;/div&gt;&lt;div&gt;        TextBox Address = row.FindControl(&quot;txtIAddress&quot;) as TextBox;&lt;/div&gt;&lt;div&gt;        FileUpload image  = row.FindControl(&quot;fuIIMage&quot;) as FileUpload;&lt;/div&gt;&lt;div&gt;        Textbox Doj = row.FindControl(&quot;txtIDOJ&quot;) as Textbox;&lt;/div&gt;&lt;div&gt;        Textbox Bdate = row.FindControl(&quot;txtIBDate&quot;) as Textbox;&lt;/div&gt;&lt;div&gt;        txtNumber Phone = row.FindControl(&quot;txtIPhonw&quot;) as txtNumber;&lt;/div&gt;&lt;div&gt;        DropDownList Status = row.FindControl(&quot;ddlIStatus&quot;) as DropDownList;&lt;/div&gt;&lt;div&gt;        DropDownList Gender = row.FindControl(&quot;ddlIGender&quot;) as DropDownList;&lt;/div&gt;&lt;div&gt;        DropDownList exp = row.FindControl(&quot;ddlIExp&quot;) as DropDownList;&lt;/div&gt;&lt;div&gt;        TextBox NoofExp = row.FindControl(&quot;txtINOExp&quot;) as TextBox;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;        bl.EMP_Code = Emp_code.Text;&lt;/div&gt;&lt;div&gt;        bl.DEP_Code = Dept_Code.SelectedValue;&lt;/div&gt;&lt;div&gt;        bl.EMP_Name = Emp_Name.Text;&lt;/div&gt;&lt;div&gt;        if (image.HasFile)&lt;/div&gt;&lt;div&gt;        {&lt;/div&gt;&lt;div&gt;            byte[] imageData = File.ReadAllBytes(image.FileName);&lt;/div&gt;&lt;div&gt;            bl.IMage = imageData;&lt;/div&gt;&lt;div&gt;        }&lt;/div&gt;&lt;div&gt;        &lt;/div&gt;&lt;div&gt;        bl.Address = Address.Text;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;        bl.Doj = Doj.EmpDate;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;        bl.Doj = Bdate.EmpDate;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;        bl.Phone = Phone.NUmber;&lt;/div&gt;&lt;div&gt;       &lt;/div&gt;&lt;div&gt;        bl.Status = Status.SelectedValue;&lt;/div&gt;&lt;div&gt;        bl.Gender = Gender.SelectedValue;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;        if (exp.SelectedValue == &quot;1&quot;)&lt;/div&gt;&lt;div&gt;        {&lt;/div&gt;&lt;div&gt;            bl.Exp = true;&lt;/div&gt;&lt;div&gt;        }&lt;/div&gt;&lt;div&gt;        else&lt;/div&gt;&lt;div&gt;        {&lt;/div&gt;&lt;div&gt;            bl.Exp = false;&lt;/div&gt;&lt;div&gt;        }&lt;/div&gt;&lt;div&gt;       &lt;/div&gt;&lt;div&gt;        if (NoofExp.Text != &quot;&quot;)&lt;/div&gt;&lt;div&gt;        {&lt;/div&gt;&lt;div&gt;            bl.NOofexp = Convert.ToInt16(NoofExp.Text);&lt;/div&gt;&lt;div&gt;        }&lt;/div&gt;&lt;div&gt;        &lt;/div&gt;&lt;div&gt;        &lt;/div&gt;&lt;div&gt;        bl.update();&lt;/div&gt;&lt;div&gt;        GVEmployee.EditIndex = -1;&lt;/div&gt;&lt;div&gt;        bind();&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;    protected void GVEmployee_RowEditing(object sender, GridViewEditEventArgs e)&lt;/div&gt;&lt;div&gt;    {&lt;/div&gt;&lt;div&gt;        GVEmployee.EditIndex = e.NewEditIndex;&lt;/div&gt;&lt;div&gt;        bind();&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;    protected void GVEmployee_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)&lt;/div&gt;&lt;div&gt;    {&lt;/div&gt;&lt;div&gt;        GVEmployee.EditIndex = -1;&lt;/div&gt;&lt;div&gt;        bind();&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;    protected void GVEmployee_PageIndexChanging(object sender, GridViewPageEventArgs e)&lt;/div&gt;&lt;div&gt;    {&lt;/div&gt;&lt;div&gt;        GVEmployee.PageIndex = e.NewPageIndex;&lt;/div&gt;&lt;div&gt;        bind();&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;    protected void GVEmployee_RowDeleting(object sender, GridViewDeleteEventArgs e)&lt;/div&gt;&lt;div&gt;    {&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;        string emp_code;&lt;/div&gt;&lt;div&gt;        emp_code = GVEmployee.DataKeys[e.RowIndex].Value.ToString();&lt;/div&gt;&lt;div&gt;        bl.EMP_Code = emp_code;&lt;/div&gt;&lt;div&gt;        bl.Delete();&lt;/div&gt;&lt;div&gt;        int i = bl.RET;&lt;/div&gt;&lt;div&gt;        if (i == 1)&lt;/div&gt;&lt;div&gt;        {&lt;/div&gt;&lt;div&gt;            System.Windows.Forms.MessageBox.Show(&quot;Record Delete Successfully!&quot;, &quot;Alert&quot;, System.Windows.Forms.MessageBoxButtons.OK);&lt;/div&gt;&lt;div&gt;        }&lt;/div&gt;&lt;div&gt;        if (i == 0)&lt;/div&gt;&lt;div&gt;        {&lt;/div&gt;&lt;div&gt;            System.Windows.Forms.MessageBox.Show(&quot;Record Delete Failed!&quot;, &quot;Alert&quot;, System.Windows.Forms.MessageBoxButtons.OK);&lt;/div&gt;&lt;div&gt;        }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;        bind();&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;    protected void btnInsert_Click(object sender, EventArgs e)&lt;/div&gt;&lt;div&gt;    {&lt;/div&gt;&lt;div&gt;        TextBox Emp_code = GVEmployee.FooterRow.FindControl(&quot;txtEmpCode&quot;) as TextBox;&lt;/div&gt;&lt;div&gt;        DropDownList Dept_Code = GVEmployee.FooterRow.FindControl(&quot;DDLIemp_CODE&quot;) as DropDownList;&lt;/div&gt;&lt;div&gt;        TextBox Emp_Name = GVEmployee.FooterRow.FindControl(&quot;txtEmpName&quot;) as TextBox;&lt;/div&gt;&lt;div&gt;        TextBox Address = GVEmployee.FooterRow.FindControl(&quot;txtAddress&quot;) as TextBox;&lt;/div&gt;&lt;div&gt;        FileUpload image = GVEmployee.FooterRow.FindControl(&quot;fuIMage&quot;) as FileUpload;&lt;/div&gt;&lt;div&gt;        Textbox  Doj = GVEmployee.FooterRow.FindControl(&quot;txtDOJ&quot;) as Textbox;&lt;/div&gt;&lt;div&gt;        Textbox Bdate = GVEmployee.FooterRow.FindControl(&quot;txtBDate&quot;) as Textbox;&lt;/div&gt;&lt;div&gt;        txtNumber Phone = GVEmployee.FooterRow.FindControl(&quot;txtPhone&quot;) as txtNumber;&lt;/div&gt;&lt;div&gt;        DropDownList Status = GVEmployee.FooterRow.FindControl(&quot;ddlStatus&quot;) as DropDownList;&lt;/div&gt;&lt;div&gt;        DropDownList Gender = GVEmployee.FooterRow.FindControl(&quot;ddlGender&quot;) as DropDownList;&lt;/div&gt;&lt;div&gt;        DropDownList exp = GVEmployee.FooterRow.FindControl(&quot;ddlExp&quot;) as DropDownList;&lt;/div&gt;&lt;div&gt;        TextBox NoofExp = GVEmployee.FooterRow.FindControl(&quot;txtNOExp&quot;) as TextBox;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;        bl.EMP_Code = Emp_code.Text;&lt;/div&gt;&lt;div&gt;        bl.DEP_Code = Dept_Code.SelectedValue;&lt;/div&gt;&lt;div&gt;        bl.EMP_Name = Emp_Name.Text;&lt;/div&gt;&lt;div&gt;        if (image.HasFile)&lt;/div&gt;&lt;div&gt;        {&lt;/div&gt;&lt;div&gt;            image.SaveAs(Server.MapPath(&quot;~/&quot; + image.FileName));&lt;/div&gt;&lt;div&gt;            byte[] imageData = File.ReadAllBytes(Server.MapPath(&quot;~/&quot; + image.FileName));&lt;/div&gt;&lt;div&gt;            &lt;/div&gt;&lt;div&gt;            bl.IMage =imageData;&lt;/div&gt;&lt;div&gt;        }&lt;/div&gt;&lt;div&gt;       &lt;/div&gt;&lt;div&gt;        bl.Address = Address.Text;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;        &lt;/div&gt;&lt;div&gt;            bl.Doj = Doj.EmpDate;&lt;/div&gt;&lt;div&gt;        &lt;/div&gt;&lt;div&gt;        &lt;/div&gt;&lt;div&gt;        //if (Bdate.EmpDate == &quot;&quot;)&lt;/div&gt;&lt;div&gt;        //{&lt;/div&gt;&lt;div&gt;        //   &lt;/div&gt;&lt;div&gt;        //}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;            bl.Bod = Bdate.EmpDate;&lt;/div&gt;&lt;div&gt;        //if (Phone.NUmber != &quot;&quot;)&lt;/div&gt;&lt;div&gt;        //{&lt;/div&gt;&lt;div&gt;        //    &lt;/div&gt;&lt;div&gt;        //}&lt;/div&gt;&lt;div&gt;            bl.Phone = Phone.NUmber;&lt;/div&gt;&lt;div&gt;        bl.Status = Status.SelectedValue;&lt;/div&gt;&lt;div&gt;        bl.Gender = Gender.SelectedValue;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;        if (exp.SelectedValue == &quot;1&quot;)&lt;/div&gt;&lt;div&gt;        {&lt;/div&gt;&lt;div&gt;            bl.Exp = true;&lt;/div&gt;&lt;div&gt;        }&lt;/div&gt;&lt;div&gt;        else&lt;/div&gt;&lt;div&gt;        {&lt;/div&gt;&lt;div&gt;            bl.Exp = false;&lt;/div&gt;&lt;div&gt;        }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;        if (NoofExp.Text != &quot;&quot;)&lt;/div&gt;&lt;div&gt;        {&lt;/div&gt;&lt;div&gt;            bl.NOofexp = Convert.ToInt16(NoofExp.Text);&lt;/div&gt;&lt;div&gt;        }&lt;/div&gt;&lt;div&gt;        &lt;/div&gt;&lt;div&gt;        bl.Insert();&lt;/div&gt;&lt;div&gt;        int i;&lt;/div&gt;&lt;div&gt;        i = bl.RET;&lt;/div&gt;&lt;div&gt;        if (i == 2)&lt;/div&gt;&lt;div&gt;        {&lt;/div&gt;&lt;div&gt;            System.Windows.Forms.MessageBox.Show(&quot;Emp_code Already Exist&quot;,&quot;Warning&quot;, System.Windows.Forms.MessageBoxButtons.OK);&lt;/div&gt;&lt;div&gt;        }&lt;/div&gt;&lt;div&gt;        if (i == 0)&lt;/div&gt;&lt;div&gt;        {&lt;/div&gt;&lt;div&gt;            System.Windows.Forms.MessageBox.Show(&quot;Record Insert Successfully!&quot;, &quot;Alert&quot;, System.Windows.Forms.MessageBoxButtons.OK);&lt;/div&gt;&lt;div&gt;        }&lt;/div&gt;&lt;div&gt;        if (i == 1)&lt;/div&gt;&lt;div&gt;        {&lt;/div&gt;&lt;div&gt;            System.Windows.Forms.MessageBox.Show(&quot;Record Insert Failed!&quot;, &quot;Alert&quot;, System.Windows.Forms.MessageBoxButtons.OK);&lt;/div&gt;&lt;div&gt;        }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;        bind();&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jigneshhirpara.blogspot.com/feeds/296195154017494711/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jigneshhirpara.blogspot.com/2011/05/inline-editing.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1603683968943160062/posts/default/296195154017494711'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1603683968943160062/posts/default/296195154017494711'/><link rel='alternate' type='text/html' href='http://jigneshhirpara.blogspot.com/2011/05/inline-editing.html' title='Inline Editing'/><author><name>Aspnet Blog</name><uri>http://www.blogger.com/profile/05026124318899904261</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='18' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjg8fG_htl_Ycu9RwdVNDUTFEN4pj2vQC5JIVWSSkzwEUWHtI_zAKWEX8AHcLhQYpVyCv_t7MzDw7CoNI1NBlagrrwvsinnwLe_a8wF8ZoTE0pNkfO1pytRog4b9RGpS_M/s220/226273_147861055282808_100001767425850_294367_7136963_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1603683968943160062.post-8513009407023384049</id><published>2011-05-15T20:38:00.000-07:00</published><updated>2011-05-15T20:39:00.300-07:00</updated><title type='text'>DataConnection</title><content type='html'>&lt;div&gt;using System;&lt;/div&gt;&lt;div&gt;using System.Collections.Generic;&lt;/div&gt;&lt;div&gt;using System.Linq;&lt;/div&gt;&lt;div&gt;using System.Web;&lt;/div&gt;&lt;div&gt;using System.Data.SqlClient;&lt;/div&gt;&lt;div&gt;using System.Data;&lt;/div&gt;&lt;div&gt;/// &lt;summary&gt;&lt;/summary&gt;&lt;/div&gt;&lt;div&gt;/// Summary description for DataConnection&lt;/div&gt;&lt;div&gt;/// &lt;/div&gt;&lt;div&gt;public class DataConnection&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;    public string ConString = &quot;Data Source=devsvr1;Initial Catalog=EMPDB;User ID=Sa;Password=Password00&quot;;&lt;/div&gt;&lt;div&gt;    public SqlConnection AppConnection = new SqlConnection();&lt;/div&gt;&lt;div&gt;    public SqlDataAdapter AppDataAdapter = new SqlDataAdapter();&lt;/div&gt;&lt;div&gt;    public SqlCommand AppCommand = new SqlCommand();&lt;/div&gt;&lt;div&gt;    public DataSet AppDataSet = new DataSet();&lt;/div&gt;&lt;div&gt;    public SqlTransaction AppTran;&lt;/div&gt;&lt;div&gt;    public DataConnection(string  Constr)&lt;/div&gt;&lt;div&gt;    {&lt;/div&gt;&lt;div&gt;        ConString = Constr;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    public void  OpenConnection()&lt;/div&gt;&lt;div&gt;    {&lt;/div&gt;&lt;div&gt;        try&lt;/div&gt;&lt;div&gt;        {&lt;/div&gt;&lt;div&gt;            AppConnection.ConnectionString = ConString;&lt;/div&gt;&lt;div&gt;            AppConnection.Open();&lt;/div&gt;&lt;div&gt;            AppCommand.Connection = AppConnection;&lt;/div&gt;&lt;div&gt;        }&lt;/div&gt;&lt;div&gt;        catch (SqlException Ex)&lt;/div&gt;&lt;div&gt;        {&lt;/div&gt;&lt;div&gt;            throw;&lt;/div&gt;&lt;div&gt;        }&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;    public void BegingTran()&lt;/div&gt;&lt;div&gt;    {&lt;/div&gt;&lt;div&gt;        AppTran = AppConnection.BeginTransaction(IsolationLevel.ReadCommitted);&lt;/div&gt;&lt;div&gt;        AppCommand.Transaction = AppTran;&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    public void RollBackTran()&lt;/div&gt;&lt;div&gt;    { AppTran.Rollback(); }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    public void CommitTran()&lt;/div&gt;&lt;div&gt;    {&lt;/div&gt;&lt;div&gt;        AppTran.Commit(); &lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;    public void closeConnction()&lt;/div&gt;&lt;div&gt;    {&lt;/div&gt;&lt;div&gt;        AppConnection.Close();&lt;/div&gt;&lt;div&gt;       &lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jigneshhirpara.blogspot.com/feeds/8513009407023384049/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jigneshhirpara.blogspot.com/2011/05/dataconnection.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1603683968943160062/posts/default/8513009407023384049'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1603683968943160062/posts/default/8513009407023384049'/><link rel='alternate' type='text/html' href='http://jigneshhirpara.blogspot.com/2011/05/dataconnection.html' title='DataConnection'/><author><name>Aspnet Blog</name><uri>http://www.blogger.com/profile/05026124318899904261</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='18' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjg8fG_htl_Ycu9RwdVNDUTFEN4pj2vQC5JIVWSSkzwEUWHtI_zAKWEX8AHcLhQYpVyCv_t7MzDw7CoNI1NBlagrrwvsinnwLe_a8wF8ZoTE0pNkfO1pytRog4b9RGpS_M/s220/226273_147861055282808_100001767425850_294367_7136963_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1603683968943160062.post-5143254564335961003</id><published>2010-05-27T23:54:00.001-07:00</published><updated>2010-05-28T00:13:05.102-07:00</updated><title type='text'>IP Voice Trading System</title><content type='html'>&lt;span style=&quot;color: rgb(77, 77, 77);font-family:FuturaBT-Book;font-size:100%;&quot;  &gt;&lt;p&gt;How can banks and financial institutions address demand for increased competitiveness, productivity and scalability on the global trading floor?  &lt;/p&gt;     &lt;p&gt;With the current market volatility, financial institutions are facing greater challenges to reduce operational costs and boost productivity. While they prepare and position themselves for the economic upturn, trading activity continues as firms rebalance their portfolio to invest in the right asset class and hedge themselves against the market volatility, which results in an increased transaction volume.&lt;/p&gt;     &lt;p&gt;For this reason, the investment on technology in the trading room has become even more critical for firms wanting to improve efficiency and develop a competitive edge. Specifically in the area of trading floor optimisation, firms are exploring ways to standardise existing technology for more effective trader communication and to expand globally or regionally with minimal increase in cost.&lt;/p&gt;     &lt;p&gt;A new trend has emerged among firms as they shift away from proprietary TDM voice technology and start building voice platforms using more pervasive IP networking technology, which is the common infrastructure for most financial institutions.&lt;/p&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://jigneshhirpara.blogspot.com/feeds/5143254564335961003/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jigneshhirpara.blogspot.com/2010/05/ip-voice-trading-system.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1603683968943160062/posts/default/5143254564335961003'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1603683968943160062/posts/default/5143254564335961003'/><link rel='alternate' type='text/html' href='http://jigneshhirpara.blogspot.com/2010/05/ip-voice-trading-system.html' title='IP Voice Trading System'/><author><name>Aspnet Blog</name><uri>http://www.blogger.com/profile/05026124318899904261</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='18' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjg8fG_htl_Ycu9RwdVNDUTFEN4pj2vQC5JIVWSSkzwEUWHtI_zAKWEX8AHcLhQYpVyCv_t7MzDw7CoNI1NBlagrrwvsinnwLe_a8wF8ZoTE0pNkfO1pytRog4b9RGpS_M/s220/226273_147861055282808_100001767425850_294367_7136963_n.jpg'/></author><thr:total>2</thr:total></entry></feed>