<?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: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-4926429223536207631</id><updated>2012-02-16T18:42:25.729-08:00</updated><title type='text'>sudagn</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://sudag.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://sudag.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default?start-index=101&amp;max-results=100'/><author><name>suda</name><uri>http://www.blogger.com/profile/15635297681991446902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>107</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4926429223536207631.post-5098004232227696985</id><published>2010-01-12T04:11:00.000-08:00</published><updated>2010-01-12T04:12:32.522-08:00</updated><title type='text'>Add and Remove HTML elements dynamically with Javascript</title><content type='html'>&lt;a href="http://www.dustindiaz.com/add-and-remove-html-elements-dynamically-with-javascript/"&gt;http://www.dustindiaz.com/add-and-remove-html-elements-dynamically-with-javascript/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4926429223536207631-5098004232227696985?l=sudag.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudag.blogspot.com/feeds/5098004232227696985/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4926429223536207631&amp;postID=5098004232227696985' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/5098004232227696985'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/5098004232227696985'/><link rel='alternate' type='text/html' href='http://sudag.blogspot.com/2010/01/add-and-remove-html-elements.html' title='Add and Remove HTML elements dynamically with Javascript'/><author><name>suda</name><uri>http://www.blogger.com/profile/15635297681991446902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4926429223536207631.post-183862928620665456</id><published>2009-11-15T21:49:00.000-08:00</published><updated>2009-11-15T21:50:53.490-08:00</updated><title type='text'>Encrypt and Decrypt Connection String</title><content type='html'>&lt;a href="Encrypt%20and%20Decrypt%20Connection%20String"&gt;http://www.dotnetspider.com/resources/2125-Encrypt-Decrypt-Connection-String.aspx&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4926429223536207631-183862928620665456?l=sudag.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudag.blogspot.com/feeds/183862928620665456/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4926429223536207631&amp;postID=183862928620665456' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/183862928620665456'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/183862928620665456'/><link rel='alternate' type='text/html' href='http://sudag.blogspot.com/2009/11/encrypt-and-decrypt-connection-string.html' title='Encrypt and Decrypt Connection String'/><author><name>suda</name><uri>http://www.blogger.com/profile/15635297681991446902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4926429223536207631.post-4074598715984795805</id><published>2009-10-23T06:21:00.000-07:00</published><updated>2009-10-23T06:22:34.511-07:00</updated><title type='text'>Make fancy buttons using CSS sliding doors technique</title><content type='html'>&lt;a href="http://www.jankoatwarpspeed.com/post/2008/04/30/make-fancy-buttons-using-css-sliding-doors-technique.aspx"&gt;http://www.jankoatwarpspeed.com/post/2008/04/30/make-fancy-buttons-using-css-sliding-doors-technique.aspx&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4926429223536207631-4074598715984795805?l=sudag.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudag.blogspot.com/feeds/4074598715984795805/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4926429223536207631&amp;postID=4074598715984795805' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/4074598715984795805'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/4074598715984795805'/><link rel='alternate' type='text/html' href='http://sudag.blogspot.com/2009/10/make-fancy-buttons-using-css-sliding.html' title='Make fancy buttons using CSS sliding doors technique'/><author><name>suda</name><uri>http://www.blogger.com/profile/15635297681991446902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4926429223536207631.post-4824700876282221970</id><published>2009-10-21T22:15:00.001-07:00</published><updated>2009-10-21T22:16:09.589-07:00</updated><title type='text'>Nested GridView in ASP.NET</title><content type='html'>http://www.codeproject.com/KB/webforms/EditNestedGridView.aspx&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4926429223536207631-4824700876282221970?l=sudag.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudag.blogspot.com/feeds/4824700876282221970/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4926429223536207631&amp;postID=4824700876282221970' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/4824700876282221970'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/4824700876282221970'/><link rel='alternate' type='text/html' href='http://sudag.blogspot.com/2009/10/nested-gridview-in-aspnet_21.html' title='Nested GridView in ASP.NET'/><author><name>suda</name><uri>http://www.blogger.com/profile/15635297681991446902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4926429223536207631.post-9208579326134831630</id><published>2009-10-21T22:15:00.000-07:00</published><updated>2009-10-21T22:16:05.316-07:00</updated><title type='text'>Nested GridView in ASP.NET</title><content type='html'>http://www.codeproject.com/KB/webforms/EditNestedGridView.aspx&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4926429223536207631-9208579326134831630?l=sudag.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudag.blogspot.com/feeds/9208579326134831630/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4926429223536207631&amp;postID=9208579326134831630' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/9208579326134831630'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/9208579326134831630'/><link rel='alternate' type='text/html' href='http://sudag.blogspot.com/2009/10/nested-gridview-in-aspnet.html' title='Nested GridView in ASP.NET'/><author><name>suda</name><uri>http://www.blogger.com/profile/15635297681991446902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4926429223536207631.post-1171285522572236925</id><published>2009-10-06T22:39:00.000-07:00</published><updated>2009-10-06T22:41:05.972-07:00</updated><title type='text'>Microsoft Anti-Cross Site Scripting Library V1.5: Protecting the Contoso Bookmark Page</title><content type='html'>&lt;a href="http://msdn.microsoft.com/en-us/library/aa973813.aspx"&gt;http://msdn.microsoft.com/en-us/library/aa973813.aspx&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4926429223536207631-1171285522572236925?l=sudag.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudag.blogspot.com/feeds/1171285522572236925/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4926429223536207631&amp;postID=1171285522572236925' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/1171285522572236925'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/1171285522572236925'/><link rel='alternate' type='text/html' href='http://sudag.blogspot.com/2009/10/httpmsdnmicrosoftcomen.html' title='Microsoft Anti-Cross Site Scripting Library V1.5: Protecting the Contoso Bookmark Page'/><author><name>suda</name><uri>http://www.blogger.com/profile/15635297681991446902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4926429223536207631.post-8754412056102893357</id><published>2009-08-26T00:15:00.000-07:00</published><updated>2009-08-26T00:18:27.168-07:00</updated><title type='text'>Export GridView To Word/Excel/PDF/CSV in ASP.Net</title><content type='html'>Export GridView To Word/Excel/PDF/CSV in ASP.Net&lt;br /&gt;&lt;br /&gt;In this article, I will explain how to export GridView to Word, Excel, PDF and CSV formats.&lt;br /&gt;&lt;br /&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 iTextSharp which is a free library for exporting html to PDF.&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;To start with I have a GridView in which I am showing Customers records from the NorthWind Database.&lt;br /&gt;&lt;br /&gt;The HTML markup of the GridView is as shown below&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;&amp;lt;asp:GridView ID="GridView1" runat="server"&lt;br /&gt;&lt;br /&gt;    AutoGenerateColumns = "false" Font-Names = "Arial"&lt;br /&gt;&lt;br /&gt;    Font-Size = "11pt" AlternatingRowStyle-BackColor = "#C2D69B" &lt;br /&gt;&lt;br /&gt;    HeaderStyle-BackColor = "green" AllowPaging ="true"  &lt;br /&gt;&lt;br /&gt;    OnPageIndexChanging = "OnPaging" &amp;gt;&lt;br /&gt;&lt;br /&gt;   &amp;lt;Columns&amp;gt;&lt;br /&gt;&lt;br /&gt;    &amp;lt;asp:BoundField ItemStyle-Width = "150px" DataField = "CustomerID"&lt;br /&gt;&lt;br /&gt;    HeaderText = "CustomerID" /&amp;gt;&lt;br /&gt;&lt;br /&gt;    &amp;lt;asp:BoundField ItemStyle-Width = "150px" DataField = "City"&lt;br /&gt;&lt;br /&gt;    HeaderText = "City"/&amp;gt;&lt;br /&gt;&lt;br /&gt;    &amp;lt;asp:BoundField ItemStyle-Width = "150px" DataField = "Country"&lt;br /&gt;&lt;br /&gt;    HeaderText = "Country"/&amp;gt;&lt;br /&gt;&lt;br /&gt;    &amp;lt;asp:BoundField ItemStyle-Width = "150px" DataField = "PostalCode"&lt;br /&gt;&lt;br /&gt;    HeaderText = "PostalCode"/&amp;gt;&lt;br /&gt;&lt;br /&gt;   &amp;lt;/Columns&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/asp:GridView&amp;gt;&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;In the figure below the GridView is shown with four buttons&lt;br /&gt;&lt;br /&gt;1.     Export To Word&lt;br /&gt;&lt;br /&gt;2.     Export To Excel&lt;br /&gt;&lt;br /&gt;3.     Export To PDF&lt;br /&gt;&lt;br /&gt;4.     Export To CSV&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;GridView with Sample Data&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Export to Microsoft Word Format&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;C#&lt;br /&gt;&lt;br /&gt;protected void btnExportWord_Click(object sender, EventArgs e)&lt;br /&gt;&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;    Response.Clear();&lt;br /&gt;&lt;br /&gt;    Response.Buffer = true;&lt;br /&gt;&lt;br /&gt;    Response.AddHeader("content-disposition",&lt;br /&gt;&lt;br /&gt;    "attachment;filename=GridViewExport.doc");&lt;br /&gt;&lt;br /&gt;    Response.Charset = "";&lt;br /&gt;&lt;br /&gt;    Response.ContentType = "application/vnd.ms-word ";&lt;br /&gt;&lt;br /&gt;    StringWriter sw= new StringWriter();&lt;br /&gt;&lt;br /&gt;    HtmlTextWriter hw = new HtmlTextWriter(sw);&lt;br /&gt;&lt;br /&gt;    GridView1.AllowPaging = false;&lt;br /&gt;&lt;br /&gt;    GridView1.DataBind();&lt;br /&gt;&lt;br /&gt;    GridView1.RenderControl(hw);&lt;br /&gt;&lt;br /&gt;    Response.Output.Write(sw.ToString());&lt;br /&gt;&lt;br /&gt;    Response.Flush();&lt;br /&gt;&lt;br /&gt;    Response.End();&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;VB.Net&lt;br /&gt;&lt;br /&gt;Protected Sub btnExportWord_Click(ByVal sender As Object,&lt;br /&gt;&lt;br /&gt;    ByVal e As EventArgs)&lt;br /&gt;&lt;br /&gt;        Response.Clear()&lt;br /&gt;&lt;br /&gt;        Response.Buffer = True&lt;br /&gt;&lt;br /&gt;        Response.AddHeader("content-disposition",&lt;br /&gt;&lt;br /&gt;        "attachment;filename=GridViewExport.doc")&lt;br /&gt;&lt;br /&gt;        Response.Charset = ""&lt;br /&gt;&lt;br /&gt;        Response.ContentType = "application/vnd.ms-word "&lt;br /&gt;&lt;br /&gt;        Dim sw As New StringWriter()&lt;br /&gt;&lt;br /&gt;        Dim hw As New HtmlTextWriter(sw)&lt;br /&gt;&lt;br /&gt;        GridView1.AllowPaging = False&lt;br /&gt;&lt;br /&gt;        GridView1.DataBind()&lt;br /&gt;&lt;br /&gt;        GridView1.RenderControl(hw)&lt;br /&gt;&lt;br /&gt;        Response.Output.Write(sw.ToString())&lt;br /&gt;&lt;br /&gt;        Response.Flush()&lt;br /&gt;&lt;br /&gt;        Response.End()&lt;br /&gt;&lt;br /&gt;    End Sub&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&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;br /&gt;&lt;br /&gt;The Output Exported File&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;GridView data exported to Word Document&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Export to Microsoft Excel Format&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&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;br /&gt;&lt;br /&gt;First I am changing the background color of each row back to white.&lt;br /&gt;&lt;br /&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;br /&gt;&lt;br /&gt;Also I am applying textmode style class to all cells and then adding the style CSS class to the GridView before rendering it, this ensures that all the contents of GridView are rendered as text.&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;protected void btnExportExcel_Click(object sender, EventArgs e)&lt;br /&gt;&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;Response.Clear();&lt;br /&gt;&lt;br /&gt;Response.Buffer = true;&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;Response.AddHeader("content-disposition",&lt;br /&gt;&lt;br /&gt;"attachment;filename=GridViewExport.xls");&lt;br /&gt;&lt;br /&gt;Response.Charset = "";&lt;br /&gt;&lt;br /&gt;Response.ContentType = "application/vnd.ms-excel";&lt;br /&gt;&lt;br /&gt;StringWriter sw = new StringWriter();&lt;br /&gt;&lt;br /&gt;HtmlTextWriter hw = new HtmlTextWriter(sw);&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;GridView1.AllowPaging = false;&lt;br /&gt;&lt;br /&gt;GridView1.DataBind();&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;//Change the Header Row back to white color&lt;br /&gt;&lt;br /&gt;GridView1.HeaderRow.Style.Add("background-color", "#FFFFFF");&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;//Apply style to Individual Cells&lt;br /&gt;&lt;br /&gt;GridView1.HeaderRow.Cells[0].Style.Add("background-color", "green");&lt;br /&gt;&lt;br /&gt;GridView1.HeaderRow.Cells[1].Style.Add("background-color", "green");&lt;br /&gt;&lt;br /&gt;GridView1.HeaderRow.Cells[2].Style.Add("background-color", "green");&lt;br /&gt;&lt;br /&gt;GridView1.HeaderRow.Cells[3].Style.Add("background-color", "green");  &lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;for (int i = 0; i &amp;lt; GridView1.Rows.Count;i++ )&lt;br /&gt;&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;    GridViewRow row = GridView1.Rows[i];&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;    //Change Color back to white&lt;br /&gt;&lt;br /&gt;    row.BackColor = System.Drawing.Color.White;&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;    //Apply text style to each Row&lt;br /&gt;&lt;br /&gt;    row.Attributes.Add("class", "textmode");&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;    //Apply style to Individual Cells of Alternating Row&lt;br /&gt;&lt;br /&gt;    if (i % 2 != 0)&lt;br /&gt;&lt;br /&gt;    {&lt;br /&gt;&lt;br /&gt;        row.Cells[0].Style.Add("background-color", "#C2D69B");&lt;br /&gt;&lt;br /&gt;        row.Cells[1].Style.Add("background-color", "#C2D69B");&lt;br /&gt;&lt;br /&gt;        row.Cells[2].Style.Add("background-color", "#C2D69B");&lt;br /&gt;&lt;br /&gt;        row.Cells[3].Style.Add("background-color", "#C2D69B");  &lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;GridView1.RenderControl(hw);&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;//style to format numbers to string&lt;br /&gt;&lt;br /&gt;string style = @"&amp;lt;style&amp;gt; .textmode { mso-number-format:\@; } &amp;lt;/style&amp;gt;";&lt;br /&gt;&lt;br /&gt;Response.Write(style);&lt;br /&gt;&lt;br /&gt;Response.Output.Write(sw.ToString());&lt;br /&gt;&lt;br /&gt;Response.Flush();&lt;br /&gt;&lt;br /&gt;Response.End();&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;&lt;br /&gt;VB.Net&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;Protected Sub btnExportExcel_Click(ByVal sender As Object,&lt;br /&gt;&lt;br /&gt;ByVal e As EventArgs)&lt;br /&gt;&lt;br /&gt;  Response.Clear()&lt;br /&gt;&lt;br /&gt;  Response.Buffer = True&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;  Response.AddHeader("content-disposition",&lt;br /&gt;&lt;br /&gt;  "attachment;filename=GridViewExport.xls")&lt;br /&gt;&lt;br /&gt;  Response.Charset = ""&lt;br /&gt;&lt;br /&gt;  Response.ContentType = "application/vnd.ms-excel"&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;  Dim sw As New StringWriter()&lt;br /&gt;&lt;br /&gt;  Dim hw As New HtmlTextWriter(sw)&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;  GridView1.AllowPaging = False&lt;br /&gt;&lt;br /&gt;  GridView1.DataBind()&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;  'Change the Header Row back to white color&lt;br /&gt;&lt;br /&gt;  GridView1.HeaderRow.Style.Add("background-color", "#FFFFFF")&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;  'Apply style to Individual Cells&lt;br /&gt;&lt;br /&gt;  GridView1.HeaderRow.Cells(0).Style.Add("background-color", "green")&lt;br /&gt;&lt;br /&gt;  GridView1.HeaderRow.Cells(1).Style.Add("background-color", "green")&lt;br /&gt;&lt;br /&gt;  GridView1.HeaderRow.Cells(2).Style.Add("background-color", "green")&lt;br /&gt;&lt;br /&gt;  GridView1.HeaderRow.Cells(3).Style.Add("background-color", "green")&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;  For i As Integer = 0 To GridView1.Rows.Count - 1&lt;br /&gt;&lt;br /&gt;   Dim row As GridViewRow = GridView1.Rows(i)&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;   'Change Color back to white&lt;br /&gt;&lt;br /&gt;   row.BackColor = System.Drawing.Color.White&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;   'Apply text style to each Row&lt;br /&gt;&lt;br /&gt;   row.Attributes.Add("class", "textmode")&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;   'Apply style to Individual Cells of Alternating Row&lt;br /&gt;&lt;br /&gt;   If i Mod 2 &amp;lt;&amp;gt; 0 Then&lt;br /&gt;&lt;br /&gt;    row.Cells(0).Style.Add("background-color", "#C2D69B")&lt;br /&gt;&lt;br /&gt;    row.Cells(1).Style.Add("background-color", "#C2D69B")&lt;br /&gt;&lt;br /&gt;    row.Cells(2).Style.Add("background-color", "#C2D69B")&lt;br /&gt;&lt;br /&gt;    row.Cells(3).Style.Add("background-color", "#C2D69B")&lt;br /&gt;&lt;br /&gt;   End If&lt;br /&gt;&lt;br /&gt;  Next&lt;br /&gt;&lt;br /&gt;  GridView1.RenderControl(hw)&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;  'style to format numbers to string&lt;br /&gt;&lt;br /&gt;  Dim style As String = "&amp;lt;style&amp;gt;.textmode{mso-number-format:\@;}&amp;lt;/style&amp;gt;"&lt;br /&gt;&lt;br /&gt;  Response.Write(style)&lt;br /&gt;&lt;br /&gt;  Response.Output.Write(sw.ToString())&lt;br /&gt;&lt;br /&gt;  Response.Flush()&lt;br /&gt;&lt;br /&gt;  Response.End()&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;The Output Exported File&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;GridView data exported to Excel Document&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Export to Portable Document Format&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&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;br /&gt;&lt;br /&gt;Then import the following Namespaces&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;C#&lt;br /&gt;&lt;br /&gt;using iTextSharp.text;&lt;br /&gt;&lt;br /&gt;using iTextSharp.text.pdf;&lt;br /&gt;&lt;br /&gt;using iTextSharp.text.html;&lt;br /&gt;&lt;br /&gt;using iTextSharp.text.html.simpleparser;&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;VB.Net&lt;br /&gt;&lt;br /&gt;Imports iTextSharp.text&lt;br /&gt;&lt;br /&gt;Imports iTextSharp.text.pdf&lt;br /&gt;&lt;br /&gt;Imports iTextSharp.text.html&lt;br /&gt;&lt;br /&gt;Imports iTextSharp.text.html.simpleparser&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;By default the iTextSharp Library does not support background color of table cells or table rows&lt;br /&gt;&lt;br /&gt;Hence when you render it as PDF your GridView is rendered without any formatting.&lt;br /&gt;&lt;br /&gt;Recently I read an article on hamang.net where the author has provided the snippet to modify the iTextSharp so that it exports the HTML with background color.&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&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;br /&gt;&lt;br /&gt;  &lt;br /&gt;              &lt;br /&gt;&lt;br /&gt;C#&lt;br /&gt;&lt;br /&gt;protected void btnExportPDF_Click(object sender, EventArgs e)&lt;br /&gt;&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;    Response.ContentType = "application/pdf";&lt;br /&gt;&lt;br /&gt;    Response.AddHeader("content-disposition",&lt;br /&gt;&lt;br /&gt;     "attachment;filename=GridViewExport.pdf");&lt;br /&gt;&lt;br /&gt;    Response.Cache.SetCacheability(HttpCacheability.NoCache);&lt;br /&gt;&lt;br /&gt;    StringWriter sw = new StringWriter();&lt;br /&gt;&lt;br /&gt;    HtmlTextWriter hw = new HtmlTextWriter(sw);&lt;br /&gt;&lt;br /&gt;    GridView1.AllowPaging = false;&lt;br /&gt;&lt;br /&gt;    GridView1.DataBind();&lt;br /&gt;&lt;br /&gt;    GridView1.RenderControl(hw);&lt;br /&gt;&lt;br /&gt;    StringReader sr = new StringReader(sw.ToString());&lt;br /&gt;&lt;br /&gt;    Document pdfDoc = new Document(PageSize.A4, 10f,10f,10f,0f);&lt;br /&gt;&lt;br /&gt;    HTMLWorker htmlparser = new HTMLWorker(pdfDoc);&lt;br /&gt;&lt;br /&gt;    PdfWriter.GetInstance(pdfDoc, Response.OutputStream);&lt;br /&gt;&lt;br /&gt;    pdfDoc.Open();&lt;br /&gt;&lt;br /&gt;    htmlparser.Parse(sr);&lt;br /&gt;&lt;br /&gt;    pdfDoc.Close();&lt;br /&gt;&lt;br /&gt;    Response.Write(pdfDoc);&lt;br /&gt;&lt;br /&gt;    Response.End(); &lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;VB.Net&lt;br /&gt;&lt;br /&gt;Protected Sub btnExportPDF_Click(ByVal sender As Object,&lt;br /&gt;&lt;br /&gt;ByVal e As EventArgs)&lt;br /&gt;&lt;br /&gt; Response.ContentType = "application/pdf"&lt;br /&gt;&lt;br /&gt; Response.AddHeader("content-disposition",&lt;br /&gt;&lt;br /&gt; "attachment;filename=GridViewExport.pdf")&lt;br /&gt;&lt;br /&gt; Response.Cache.SetCacheability(HttpCacheability.NoCache)&lt;br /&gt;&lt;br /&gt; Dim sw As New StringWriter()&lt;br /&gt;&lt;br /&gt; Dim hw As New HtmlTextWriter(sw)&lt;br /&gt;&lt;br /&gt; GridView1.AllowPaging = False&lt;br /&gt;&lt;br /&gt; GridView1.DataBind()&lt;br /&gt;&lt;br /&gt; GridView1.RenderControl(hw)&lt;br /&gt;&lt;br /&gt; Dim sr As New StringReader(sw.ToString())&lt;br /&gt;&lt;br /&gt; Dim pdfDoc As New Document(PageSize.A4, 10.0F, 10.0F, 10.0F, 0.0F)&lt;br /&gt;&lt;br /&gt; Dim htmlparser As New HTMLWorker(pdfDoc)&lt;br /&gt;&lt;br /&gt; PdfWriter.GetInstance(pdfDoc, Response.OutputStream)&lt;br /&gt;&lt;br /&gt; pdfDoc.Open()&lt;br /&gt;&lt;br /&gt; htmlparser.Parse(sr)&lt;br /&gt;&lt;br /&gt; pdfDoc.Close()&lt;br /&gt;&lt;br /&gt; Response.Write(pdfDoc)&lt;br /&gt;&lt;br /&gt; Response.End()&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;The Output Exported File&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;GridView data exported to PDF Document&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Export to Text/CSV&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;Finally comes exporting GridView to CSV or Text File delimited by a separator like comma.&lt;br /&gt;&lt;br /&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;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;C#&lt;br /&gt;&lt;br /&gt;protected void btnExportCSV_Click(object sender, EventArgs e)&lt;br /&gt;&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;    Response.Clear();&lt;br /&gt;&lt;br /&gt;    Response.Buffer = true;&lt;br /&gt;&lt;br /&gt;    Response.AddHeader("content-disposition",&lt;br /&gt;&lt;br /&gt;     "attachment;filename=GridViewExport.csv");&lt;br /&gt;&lt;br /&gt;    Response.Charset = "";&lt;br /&gt;&lt;br /&gt;    Response.ContentType = "application/text";&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;    GridView1.AllowPaging = false;&lt;br /&gt;&lt;br /&gt;    GridView1.DataBind();&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;    StringBuilder sb = new StringBuilder();&lt;br /&gt;&lt;br /&gt;    for (int k = 0; k &amp;lt; GridView1.Columns.Count; k++)&lt;br /&gt;&lt;br /&gt;    {&lt;br /&gt;&lt;br /&gt;        //add separator&lt;br /&gt;&lt;br /&gt;        sb.Append(GridView1.Columns[k].HeaderText + ',');&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    //append new line&lt;br /&gt;&lt;br /&gt;    sb.Append("\r\n");&lt;br /&gt;&lt;br /&gt;    for (int i = 0; i &amp;lt; GridView1.Rows.Count; i++)&lt;br /&gt;&lt;br /&gt;    {&lt;br /&gt;&lt;br /&gt;        for (int k = 0; k &amp;lt; GridView1.Columns.Count; k++)&lt;br /&gt;&lt;br /&gt;        {&lt;br /&gt;&lt;br /&gt;            //add separator&lt;br /&gt;&lt;br /&gt;            sb.Append(GridView1.Rows[i].Cells[k].Text + ',');&lt;br /&gt;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        //append new line&lt;br /&gt;&lt;br /&gt;        sb.Append("\r\n");&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    Response.Output.Write(sb.ToString());&lt;br /&gt;&lt;br /&gt;    Response.Flush();&lt;br /&gt;&lt;br /&gt;    Response.End();&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;      &lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;VB.Net&lt;br /&gt;&lt;br /&gt;Protected Sub btnExportCSV_Click(ByVal sender As Object,&lt;br /&gt;&lt;br /&gt;ByVal e As EventArgs)&lt;br /&gt;&lt;br /&gt; Response.Clear()&lt;br /&gt;&lt;br /&gt; Response.Buffer = True&lt;br /&gt;&lt;br /&gt; Response.AddHeader("content-disposition",&lt;br /&gt;&lt;br /&gt; "attachment;filename=GridViewExport.csv")&lt;br /&gt;&lt;br /&gt; Response.Charset = ""&lt;br /&gt;&lt;br /&gt; Response.ContentType = "application/text"&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; GridView1.AllowPaging = False&lt;br /&gt;&lt;br /&gt; GridView1.DataBind()&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; Dim sb As New StringBuilder()&lt;br /&gt;&lt;br /&gt; For k As Integer = 0 To GridView1.Columns.Count - 1&lt;br /&gt;&lt;br /&gt;  'add separator&lt;br /&gt;&lt;br /&gt;  sb.Append(GridView1.Columns(k).HeaderText + ","c)&lt;br /&gt;&lt;br /&gt; Next&lt;br /&gt;&lt;br /&gt; 'append new line&lt;br /&gt;&lt;br /&gt; sb.Append(vbCr &amp; vbLf)&lt;br /&gt;&lt;br /&gt; For i As Integer = 0 To GridView1.Rows.Count - 1&lt;br /&gt;&lt;br /&gt;  For k As Integer = 0 To GridView1.Columns.Count - 1&lt;br /&gt;&lt;br /&gt;   'add separator&lt;br /&gt;&lt;br /&gt;   sb.Append(GridView1.Rows(i).Cells(k).Text + ","c)&lt;br /&gt;&lt;br /&gt;  Next&lt;br /&gt;&lt;br /&gt;  'append new line&lt;br /&gt;&lt;br /&gt;  sb.Append(vbCr &amp; vbLf)&lt;br /&gt;&lt;br /&gt; Next&lt;br /&gt;&lt;br /&gt; Response.Output.Write(sb.ToString())&lt;br /&gt;&lt;br /&gt; Response.Flush()&lt;br /&gt;&lt;br /&gt; Response.End()&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;The Output Exported File&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;GridView data exported to CSV File&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;When you run the application first time and click export you might receive the following error&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Error encountered when you click export&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;To avoid the error you will need to add this event which ensures that the GridView is Rendered before exporting.&lt;br /&gt;  &lt;br /&gt;&lt;br /&gt;C#&lt;br /&gt;&lt;br /&gt;public override void VerifyRenderingInServerForm(Control control)&lt;br /&gt;&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;    /* Verifies that the control is rendered */&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;VB.Net&lt;br /&gt;&lt;br /&gt;Public Overloads Overrides Sub VerifyRenderingInServerForm&lt;br /&gt;&lt;br /&gt;(ByVal control As Control)&lt;br /&gt;&lt;br /&gt;    ' Verifies that the control is rendered&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;This completes the article you can view the live demo here&lt;br /&gt;&lt;br /&gt;The source code is available in C# and VB.Net here&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4926429223536207631-8754412056102893357?l=sudag.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudag.blogspot.com/feeds/8754412056102893357/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4926429223536207631&amp;postID=8754412056102893357' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/8754412056102893357'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/8754412056102893357'/><link rel='alternate' type='text/html' href='http://sudag.blogspot.com/2009/08/export-gridview-to-wordexcelpdfcsv-in_26.html' title='Export GridView To Word/Excel/PDF/CSV in ASP.Net'/><author><name>suda</name><uri>http://www.blogger.com/profile/15635297681991446902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4926429223536207631.post-727144765362382214</id><published>2009-08-25T23:58:00.000-07:00</published><updated>2009-08-26T00:01:00.100-07:00</updated><title type='text'>Adding QueryString Parameters to the SiteMapNode</title><content type='html'>There is no way to add querystring parameters to the SiteMapNode in a SiteMap control "out of the box." I'm quite surprised there is no option but luckily the SiteMap uses the provider model. After a Live search, I was able to find a solution provided by Bobby DeRosa. By creating a custom provider, this can be accomplished. The project I was on is an update of an ASP.net app written in VB.net so here is my VB.net port:&lt;br /&gt;&lt;br /&gt;    Imports System.Collections.Specialized&lt;br /&gt;    Imports System.Web&lt;br /&gt;&lt;br /&gt;    Namespace Configuration&lt;br /&gt;&lt;br /&gt;        Public Class ExtendedSiteMapProvider&lt;br /&gt;            Inherits XmlSiteMapProvider&lt;br /&gt;&lt;br /&gt;            Public Overrides Sub Initialize(ByVal name As String, ByVal attributes As NameValueCollection)&lt;br /&gt;                MyBase.Initialize(name, attributes)&lt;br /&gt;                Dim resolveHandler As New SiteMapResolveEventHandler(AddressOf SmartSiteMapProvider_SiteMapResolve)&lt;br /&gt;                AddHandler Me.SiteMapResolve, resolveHandler&lt;br /&gt;            End Sub&lt;br /&gt;&lt;br /&gt;            Function SmartSiteMapProvider_SiteMapResolve(ByVal sender As Object, ByVal e As SiteMapResolveEventArgs) As SiteMapNode&lt;br /&gt;                If (SiteMap.CurrentNode Is Nothing) Then Return Nothing&lt;br /&gt;&lt;br /&gt;                Dim this As New XmlSiteMapProvider&lt;br /&gt;                Dim temp As SiteMapNode&lt;br /&gt;                temp = SiteMap.CurrentNode.Clone(True)&lt;br /&gt;                Dim u As Uri = New Uri(e.Context.Request.Url.ToString())&lt;br /&gt;                Dim tempNode As SiteMapNode = temp&lt;br /&gt;&lt;br /&gt;                While Not tempNode Is Nothing&lt;br /&gt;                    Dim qs As String = GetQueryString(tempNode, e.Context)&lt;br /&gt;                    If Not qs Is Nothing Then&lt;br /&gt;                        If Not tempNode Is Nothing Then&lt;br /&gt;                            tempNode.Url += qs&lt;br /&gt;                        End If&lt;br /&gt;                    End If&lt;br /&gt;                    tempNode = tempNode.ParentNode&lt;br /&gt;                End While&lt;br /&gt;&lt;br /&gt;                Return temp&lt;br /&gt;            End Function&lt;br /&gt;&lt;br /&gt;            Private Function GetQueryString(ByVal node As SiteMapNode, ByVal context As HttpContext) As String&lt;br /&gt;                If node("queryStringToInclude") Is Nothing Then Return Nothing&lt;br /&gt;&lt;br /&gt;                Dim values As NameValueCollection = New NameValueCollection&lt;br /&gt;                Dim vars() As String = node("queryStringToInclude").Split(",".ToCharArray())&lt;br /&gt;                Dim s As String&lt;br /&gt;&lt;br /&gt;                For Each s In vars&lt;br /&gt;                    Dim var As String = s.Trim()&lt;br /&gt;                    If context.Request.QueryString(var) Is Nothing Then Continue For&lt;br /&gt;                    values.Add(var, context.Request.QueryString(var))&lt;br /&gt;                Next&lt;br /&gt;&lt;br /&gt;                If values.Count = 0 Then Return Nothing&lt;br /&gt;&lt;br /&gt;                Return NameValueCollectionToString(values)&lt;br /&gt;            End Function&lt;br /&gt;&lt;br /&gt;            Private Function NameValueCollectionToString(ByVal col As NameValueCollection) As String&lt;br /&gt;                Dim parts(col.Count - 1) As String&lt;br /&gt;                Dim keys() As String = col.AllKeys&lt;br /&gt;&lt;br /&gt;                For i As Integer = 0 To keys.Length - 1&lt;br /&gt;                    parts(i) = keys(i) &amp; "=" &amp; col(keys(i))&lt;br /&gt;                Next&lt;br /&gt;&lt;br /&gt;                Dim url As String = "?" &amp; String.Join("&amp;", parts)&lt;br /&gt;&lt;br /&gt;                Return url&lt;br /&gt;            End Function&lt;br /&gt;&lt;br /&gt;        End Class&lt;br /&gt;&lt;br /&gt;    End Namespace&lt;br /&gt;&lt;br /&gt;I added the following to the web.config:&lt;br /&gt;&lt;br /&gt;    &amp;lt;siteMap defaultProvider="ExtendedSiteMapProvider" enabled="true"&amp;gt;&lt;br /&gt;        &amp;lt;providers&amp;gt;&lt;br /&gt;            &amp;lt;clear /&amp;gt;&lt;br /&gt;            &amp;lt;add name="ExtendedSiteMapProvider" type="Configuration.ExtendedSiteMapProvider" siteMapFile="web.sitemap" securityTrimmingEnabled="true" /&amp;gt;&lt;br /&gt;        &amp;lt;/providers&amp;gt;&lt;br /&gt;    &amp;lt;/siteMap&amp;gt;&lt;br /&gt;&lt;br /&gt;If I had a page of products on products.aspx, displayed the details of the product on details.aspx, and had a separate update.aspx page, my web.sitemap might look like this:&lt;br /&gt;&lt;br /&gt;    &amp;lt;?xml version="1.0" encoding="utf-8" ?&amp;gt;&lt;br /&gt;    &amp;lt;siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" &amp;gt;&lt;br /&gt;        &amp;lt;siteMapNode url="~/" title="Main Page"&amp;gt;&lt;br /&gt;                &amp;lt;siteMapNode url="~/products.aspx" title="Products" &amp;gt;&lt;br /&gt;                    &amp;lt;siteMapNode url="~/details.aspx" title="Product Details" queryStringToInclude="ProductID" &amp;gt;&lt;br /&gt;                        &amp;lt;siteMapNode url="~/update.aspx" title="Updating a Product" /&amp;gt;&lt;br /&gt;                    &amp;lt;/siteMapNode&amp;gt;&lt;br /&gt;                &amp;lt;/siteMapNode&amp;gt;&lt;br /&gt;        &amp;lt;/siteMapNode&amp;gt;&lt;br /&gt;    &amp;lt;/siteMap&amp;gt;&lt;br /&gt;&lt;br /&gt;So, on /update.aspx?ProductID=3, the SiteMapNode for Product Details would have a url of /details.aspx?ProductID=3.&lt;br /&gt;&lt;br /&gt;Hopefully a similar feature will be added soon to the ASP.net SiteMap control.&lt;br /&gt;&lt;br /&gt;&amp;lt;span style="font-weight:bold;"&amp;gt;C#:&amp;lt;/span&amp;gt;&lt;br /&gt;Great job!  I took your C# code and had to make a few small changes to get it working correctly (on VS2008 &amp; .NET 3.5 sp1):&lt;br /&gt;&lt;br /&gt;#region Using Directives&lt;br /&gt;&lt;br /&gt;using System.Collections.Specialized;&lt;br /&gt;&lt;br /&gt;using System.Web;&lt;br /&gt;&lt;br /&gt;#endregion&lt;br /&gt;&lt;br /&gt;namespace Configuration&lt;br /&gt;&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;   public class ExtendedSiteMapProvider : XmlSiteMapProvider&lt;br /&gt;&lt;br /&gt;   {&lt;br /&gt;&lt;br /&gt;       public override void Initialize(string name, NameValueCollection attributes)&lt;br /&gt;&lt;br /&gt;       {&lt;br /&gt;&lt;br /&gt;           base.Initialize(name, attributes);&lt;br /&gt;&lt;br /&gt;           this.SiteMapResolve += SmartSiteMapProvider_SiteMapResolve;&lt;br /&gt;&lt;br /&gt;       }&lt;br /&gt;&lt;br /&gt;       static SiteMapNode SmartSiteMapProvider_SiteMapResolve(object sender, SiteMapResolveEventArgs e)&lt;br /&gt;&lt;br /&gt;       {&lt;br /&gt;&lt;br /&gt;           if ((SiteMap.CurrentNode == null)) return null;&lt;br /&gt;&lt;br /&gt;           SiteMapNode temp = SiteMap.CurrentNode.Clone(true);&lt;br /&gt;&lt;br /&gt;           SiteMapNode tempNode = temp;&lt;br /&gt;&lt;br /&gt;           while (tempNode != null)&lt;br /&gt;&lt;br /&gt;           {&lt;br /&gt;&lt;br /&gt;               string qs = GetQueryString(tempNode, e.Context);&lt;br /&gt;&lt;br /&gt;               if (qs != null)&lt;br /&gt;&lt;br /&gt;               {&lt;br /&gt;&lt;br /&gt;                   tempNode.Url += qs;&lt;br /&gt;&lt;br /&gt;               }&lt;br /&gt;&lt;br /&gt;               tempNode = tempNode.ParentNode;&lt;br /&gt;&lt;br /&gt;           }&lt;br /&gt;&lt;br /&gt;           return temp;&lt;br /&gt;&lt;br /&gt;       }&lt;br /&gt;&lt;br /&gt;       private static string GetQueryString(SiteMapNode node, HttpContext context)&lt;br /&gt;&lt;br /&gt;       {&lt;br /&gt;&lt;br /&gt;           if (node["queryStringToInclude"] == null) return null;&lt;br /&gt;&lt;br /&gt;           NameValueCollection values = new NameValueCollection();&lt;br /&gt;&lt;br /&gt;           string[] vars = node["queryStringToInclude"].Split(",".ToCharArray());&lt;br /&gt;&lt;br /&gt;           foreach (string s in vars)&lt;br /&gt;&lt;br /&gt;           {&lt;br /&gt;&lt;br /&gt;               string var = s.Trim();&lt;br /&gt;&lt;br /&gt;               if (context.Request.QueryString[var] == null) continue;&lt;br /&gt;&lt;br /&gt;               values.Add(var, context.Request.QueryString[var]);&lt;br /&gt;&lt;br /&gt;           }&lt;br /&gt;&lt;br /&gt;           if (values.Count == 0) return null;&lt;br /&gt;&lt;br /&gt;           return NameValueCollectionToString(values);&lt;br /&gt;&lt;br /&gt;       }&lt;br /&gt;&lt;br /&gt;       private static string NameValueCollectionToString(NameValueCollection col)&lt;br /&gt;&lt;br /&gt;       {&lt;br /&gt;&lt;br /&gt;           string[] parts = new string[col.Count];&lt;br /&gt;&lt;br /&gt;           string[] keys = col.AllKeys;&lt;br /&gt;&lt;br /&gt;           for (int i = 0; i &amp;lt;= keys.Length - 1; i++)&lt;br /&gt;&lt;br /&gt;           {&lt;br /&gt;&lt;br /&gt;               parts[i] = keys[i] + "=" + col[keys[i]];&lt;br /&gt;&lt;br /&gt;           }&lt;br /&gt;&lt;br /&gt;           return "?" + string.Join("&amp;", parts);&lt;br /&gt;&lt;br /&gt;       }&lt;br /&gt;&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4926429223536207631-727144765362382214?l=sudag.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudag.blogspot.com/feeds/727144765362382214/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4926429223536207631&amp;postID=727144765362382214' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/727144765362382214'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/727144765362382214'/><link rel='alternate' type='text/html' href='http://sudag.blogspot.com/2009/08/adding-querystring-parameters-to.html' title='Adding QueryString Parameters to the SiteMapNode'/><author><name>suda</name><uri>http://www.blogger.com/profile/15635297681991446902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4926429223536207631.post-4964123717736881714</id><published>2009-08-25T23:54:00.000-07:00</published><updated>2009-08-25T23:57:48.857-07:00</updated><title type='text'>SiteMapProvider doesn't take QueryString into consideration</title><content type='html'>I was pretty stoked to find that ASP.NET 2.0 included a new control called SiteMap. This control will display a breadcrumb trail of links as you navigate through your site. By default, the data is loaded from a web.sitemap file that sits in the web app root. Although you can load the data from any source, this is the default and uses the XmlSiteMapProvider provider to populate the data.&lt;br /&gt;&lt;br /&gt;This is an example of data found in the web.sitemap file:&lt;br /&gt;Copy code to clipboard in IE or select code for Firefox&lt;br /&gt;&lt;br /&gt;&amp;lt;?xml version="1.0" encoding="utf-8" ?&amp;gt;&lt;br /&gt;&amp;lt;siteMap&amp;gt;&lt;br /&gt;    &amp;lt;siteMapNode url="~/default.aspx" title="Home"&amp;gt;&lt;br /&gt;        &amp;lt;siteMapNode url="~/hotels/list.aspx" title="Hotel Listings"&amp;gt;&lt;br /&gt;            &amp;lt;siteMapNode url="~/hotels/details.aspx" title="Hotel Information"&amp;gt;&lt;br /&gt;                &amp;lt;siteMapNode url="~/hotels/update.aspx" title="Update Hotel"/&amp;gt;&lt;br /&gt;            &amp;lt;/siteMapNode&amp;gt;&lt;br /&gt;        &amp;lt;/siteMapNode&amp;gt;&lt;br /&gt;    &amp;lt;/siteMapNode&amp;gt;&lt;br /&gt;&amp;lt;/siteMap&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This works fine if you aren't ever using querystring variables. But let's say when you get down to the details.aspx page, you tag on a HotelID variable to the querystring. Same thing happens when you go deeper into update.aspx.&lt;br /&gt;&lt;br /&gt;Your breadcrumb will look like this:&lt;br /&gt;&lt;br /&gt;Home &amp;gt; Hotel Listings &amp;gt; Hotel Information &amp;gt; Update Hotel&lt;br /&gt;&lt;br /&gt;Given my current url is "update.aspx?HotelID=1234", I should have some way to propagate the current HotelID querystring variable to the other links, if they need it, which details.apx does.&lt;br /&gt;&lt;br /&gt;I tried endlessly to get around this. I tried derriving my own class from XmlSiteProvider, but ASP.NET crashes as soon as you mess w/ the child nodes in the BuildSiteMap() method.&lt;br /&gt;&lt;br /&gt;I tried binding an event handler to the SiteMap.SiteMapResolve event - but the Request collection is always unavailable at the time when this event is triggered.&lt;br /&gt;&lt;br /&gt;I tried to modify the url's of the nodes showing on the screen dynamically, but supid SiteMapNode.Url property is Read-Only - ARGGG!!&lt;br /&gt;&lt;br /&gt;It just amazes me that MS didn't see this coming &amp; allow for it in the XML config. They could have added a "incorporate" attribute in the node that allowed you to specify a comma-delimited list of querystring variables that would be needed for that URL to work, like this:&lt;br /&gt;&lt;br /&gt;Copy code to clipboard in IE or select code for Firefox&lt;br /&gt;&lt;br /&gt;&amp;lt;siteMapNode url="~/hotels/details.aspx" title="Hotel Information" reliantOn="HotelID, UserID"&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;or give me a way to add in the querystring variables I want to pull from the current context like this:&lt;br /&gt;&lt;br /&gt;Copy code to clipboard in IE or select code for Firefox&lt;br /&gt;&lt;br /&gt;&amp;lt;siteMapNode url="~/hotels/details.aspx?HotelID={HotelID}" title="Hotel Information"&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;And the SiteMapProvider would be smart enough to replace the vars in braces w/ the variable from the current querystring.&lt;br /&gt;&lt;br /&gt;I never thought getting something so simple to work would be so hard. If anyone has a solution, pony up.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4926429223536207631-4964123717736881714?l=sudag.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudag.blogspot.com/feeds/4964123717736881714/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4926429223536207631&amp;postID=4964123717736881714' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/4964123717736881714'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/4964123717736881714'/><link rel='alternate' type='text/html' href='http://sudag.blogspot.com/2009/08/sitemapprovider-doesnt-take-querystring.html' title='SiteMapProvider doesn&apos;t take QueryString into consideration'/><author><name>suda</name><uri>http://www.blogger.com/profile/15635297681991446902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4926429223536207631.post-6906590840393129621</id><published>2009-07-01T04:54:00.000-07:00</published><updated>2009-07-02T23:12:23.306-07:00</updated><title type='text'>GridView with Thumbnail Images</title><content type='html'>&lt;table width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td valign="middle" width="50%"&gt;&lt;p class="ArticleTitle"&gt;GridView with Thumbnail Images – Part 2&lt;/p&gt; &lt;p class="MsoNormal"&gt;&lt;span lang="EN-AU"&gt;&lt;/span&gt; &lt;/p&gt; &lt;p class="ArticleContent"&gt;In &lt;a href="http://www.codedigest.com/Articles/ASPNET/102_GridView_with_Thumbnail_Images_%e2%80%93_Part_1.aspx"&gt;Part  1&lt;/a&gt;, we have seen how to display the full image in a popup window when the user clicks the thumbnail image displayed in the GridView. We all know that displaying something on a popup window will not give a better user experience. There might be a chance where the popup blocker is turned on in the user’s machine and it will not allow the user to view the full image. &lt;/p&gt; &lt;p class="ArticleContent"&gt;Part 2 of this article will also generate the thumbnail  image for the images stored in database to display on the GridView. Like &lt;a href="http://www.codedigest.com/Articles/ASPNET/102_GridView_with_Thumbnail_Images_%e2%80%93_Part_1.aspx"&gt;Part  1&lt;/a&gt;, when the user clicks on the thumbnail image it  will also display the full image, but inside a DIV tag on the same page instead of a  popup, which gives a better user experience.&lt;/p&gt;          &lt;/td&gt;         &lt;td class="NonPrintable" width="50%"&gt;                   &lt;!-- Ads go here --&gt;         &lt;script type="text/javascript"&gt;          &lt;!--          lqm_channel=1;         lqm_publisher=260;         lqm_zone=1;         lqm_format=7;         //--&gt;         &lt;/script&gt;         &lt;script type="text/javascript" src="http://a.lakequincy.com/s.js"&gt;&lt;/script&gt;&lt;script type="text/javascript" src="http://a.lakequincy.com/i.ashx?&amp;amp;channel=1&amp;amp;format=7&amp;amp;pageid=315401F8-25F0-48F0-593D-20DDF7D2D447&amp;amp;publisher=260&amp;amp;ypos=507&amp;amp;zone=1&amp;amp;ct=6"&gt;&lt;/script&gt;&lt;a href="http://a.lakequincy.com/c.ashx?channel=1&amp;amp;format=7&amp;amp;pageid=315401F8-25F0-48F0-593D-20DDF7D2D447&amp;amp;publisher=260&amp;amp;url=%2fi.ashx&amp;amp;ypos=507&amp;amp;zone=1&amp;amp;country=IN&amp;amp;userguid=08d06a70-9ac1-44b0-ac5c-bfae69ff29e2&amp;amp;placement=3454&amp;amp;creative=2649&amp;amp;" target="_top"&gt;&lt;img src="http://a.lakequincy.com/img/633785016957200398.gif" alt="Eclipse Summit" width="336" border="0" height="280" /&gt;&lt;/a&gt;                                   &lt;/td&gt;        &lt;/tr&gt;                          &lt;tr&gt;       &lt;td colspan="2"&gt;              &lt;table&gt;       &lt;tbody&gt;&lt;tr&gt;           &lt;td&gt;              &lt;p class="ArticleContent"&gt;Creating the thumbnail image and displaying the full  image is done by the same HttpHandler implementation we have used in &lt;a href="http://www.codedigest.com/Articles/ASPNET/102_GridView_with_Thumbnail_Images_%e2%80%93_Part_1.aspx"&gt;Part  1&lt;/a&gt;.&lt;/p&gt; &lt;p class="MsoNormal"&gt;&lt;span lang="EN-AU"&gt;&lt;/span&gt; &lt;/p&gt; &lt;p class="ArticleSubtitle"&gt;Creating Thumbnail Image&lt;/p&gt; &lt;p class="ArticleContent"&gt;For reference purpose, we will have the HttpHandler  implementation here also. For description of the code refer &lt;a href="http://www.codedigest.com/Articles/ASPNET/102_GridView_with_Thumbnail_Images_%e2%80%93_Part_1.aspx"&gt;Part  1&lt;/a&gt;.&lt;/p&gt; &lt;p class="CodeTitle"&gt;Thumbnail.ashx&lt;/p&gt; &lt;p class="ArticleCode"&gt;public void ProcessRequest (HttpContext context) {&lt;/p&gt; &lt;p class="ArticleCode"&gt;        string imageid =  context.Request.QueryString["ImID"];&lt;/p&gt; &lt;p class="ArticleCode"&gt;		if (imageid == null || imageid == "")&lt;/p&gt; &lt;p class="ArticleCode"&gt;		{&lt;/p&gt; &lt;p class="ArticleCode"&gt;		//Set a default imageID&lt;/p&gt; &lt;p class="ArticleCode"&gt;		imageid = "1";&lt;/p&gt; &lt;p class="ArticleCode"&gt;		}&lt;/p&gt; &lt;p class="ArticleCode"&gt;        SqlConnection connection = new  SqlConnection(ConfigurationManager.ConnectionStrings["connectionString"].ConnectionString);&lt;/p&gt; &lt;p class="ArticleCode"&gt;        connection.Open();&lt;/p&gt; &lt;p class="ArticleCode"&gt;        SqlCommand command = new SqlCommand("select Image  from Image where ImageID="+imageid, connection);&lt;/p&gt; &lt;p class="ArticleCode"&gt;        SqlDataReader dr = command.ExecuteReader();&lt;/p&gt; &lt;p class="ArticleCode"&gt;        dr.Read();&lt;/p&gt; &lt;p class="ArticleCode"&gt;        &lt;/p&gt; &lt;p class="ArticleCode"&gt;        Stream str = new MemoryStream((Byte[])dr[0]);        &lt;/p&gt; &lt;p class="ArticleCode"&gt; &lt;/p&gt; &lt;p class="ArticleCode"&gt;        Bitmap loBMP = new Bitmap(str);&lt;/p&gt; &lt;p class="ArticleCode"&gt;        Bitmap bmpOut = new Bitmap(100, 100);&lt;/p&gt; &lt;p class="ArticleCode"&gt; &lt;/p&gt; &lt;p class="ArticleCode"&gt;        Graphics g = Graphics.FromImage(bmpOut);&lt;/p&gt; &lt;p class="ArticleCode"&gt;        g.InterpolationMode =  System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;&lt;/p&gt; &lt;p class="ArticleCode"&gt;        g.FillRectangle(Brushes.White, 0, 0, 100, 100);&lt;/p&gt; &lt;p class="ArticleCode"&gt;        g.DrawImage(loBMP, 0, 0, 100, 100);&lt;/p&gt; &lt;p class="ArticleCode"&gt;        MemoryStream ms = new MemoryStream();&lt;/p&gt; &lt;p class="ArticleCode"&gt;        bmpOut.Save(ms,  System.Drawing.Imaging.ImageFormat.Png);&lt;/p&gt; &lt;p class="ArticleCode"&gt;        byte[] bmpBytes = ms.GetBuffer();&lt;/p&gt; &lt;p class="ArticleCode"&gt;        bmpOut.Dispose();&lt;/p&gt; &lt;p class="ArticleCode"&gt;        ms.Close();&lt;/p&gt; &lt;p class="ArticleCode"&gt;        context.Response.BinaryWrite(bmpBytes);             &lt;/p&gt; &lt;p class="ArticleCode"&gt;        connection.Close();&lt;/p&gt; &lt;p class="ArticleCode"&gt;        context.Response.End();           &lt;/p&gt; &lt;p class="ArticleCode"&gt;    }&lt;/p&gt; &lt;p class="MsoNormal"&gt;&lt;span lang="EN-AU"&gt;&lt;/span&gt; &lt;/p&gt; &lt;p class="ArticleSubtitle"&gt;Displaying the Original Image&lt;/p&gt; &lt;p class="ArticleSubtitle"&gt;FullImage.ashx&lt;/p&gt; &lt;p class="ArticleCode"&gt;public void ProcessRequest (HttpContext context) {&lt;/p&gt; &lt;p class="ArticleCode"&gt;       string imageid =  context.Request.QueryString["ImID"];&lt;/p&gt; &lt;p class="ArticleCode"&gt;		if (imageid == null || imageid == "")&lt;/p&gt; &lt;p class="ArticleCode"&gt;		{&lt;/p&gt; &lt;p class="ArticleCode"&gt;		//Set a default imageID&lt;/p&gt; &lt;p class="ArticleCode"&gt;		imageid = "1";&lt;/p&gt; &lt;p class="ArticleCode"&gt;		}&lt;/p&gt; &lt;p class="ArticleCode"&gt;        SqlConnection connection = new  SqlConnection(ConfigurationManager.ConnectionStrings["connectionString"].ConnectionString);&lt;/p&gt; &lt;p class="ArticleCode"&gt;        connection.Open();&lt;/p&gt; &lt;p class="ArticleCode"&gt;        SqlCommand command = new SqlCommand("select Image  from Image where ImageID="+imageid, connection);&lt;/p&gt; &lt;p class="ArticleCode"&gt;        SqlDataReader dr = command.ExecuteReader();&lt;/p&gt; &lt;p class="ArticleCode"&gt;        dr.Read();&lt;/p&gt; &lt;p class="ArticleCode"&gt;        context.Response.BinaryWrite((Byte[])dr[0]);&lt;/p&gt; &lt;p class="ArticleCode"&gt;        connection.Close();&lt;/p&gt; &lt;p class="ArticleCode"&gt;        context.Response.End();  &lt;/p&gt; &lt;p class="ArticleCode"&gt;    }&lt;/p&gt; &lt;p class="MsoNormal"&gt;&lt;b&gt;&lt;span lang="EN-AU"&gt;&lt;/span&gt;&lt;/b&gt; &lt;/p&gt; &lt;p class="ArticleSubtitle"&gt;Note&lt;/p&gt; &lt;p class="ArticleContent"&gt;I have given only the ProcessRequest() method in the above code. Refer the source code attachment for the full code. I have set default imageID, make sure you are giving an existing imageId in database for the code to work without any errors.&lt;/p&gt; &lt;p class="MsoNormal"&gt;&lt;span lang="EN-AU"&gt;&lt;/span&gt; &lt;/p&gt; &lt;p class="ArticleSubtitle"&gt;Using DIV Tag to display the full image&lt;/p&gt; &lt;p class="ArticleContent"&gt;To implement this, we will declare a DIV tag in the ASPX page with display  property set to none. This indicates that the DIV tag will not be visible by  default when the page is loaded. Declare a &lt;img src="http://www.blogger.com/post-edit.g?blogID=4926429223536207631&amp;amp;postID=6906590840393129621" /&gt; tag inside this DIV tag  to display the full image. When the user clicks the thumbnail image, we can  enable the DIV tag through a javascript function and pass the ImID of the image  to call the &lt;b&gt;FullImage.ashx &lt;/b&gt;HttpHandler for displaying the full image in  the &lt;img src="http://www.blogger.com/post-edit.g?blogID=4926429223536207631&amp;amp;postID=6906590840393129621" /&gt; tag. Also, we will have a button called Close inside the DIV tag  to close the display of full image i.e. on click of this button we will again  make the DIV tag’s display property to none. Refer the below Jscript code,&lt;/p&gt;             &lt;/td&gt;            &lt;td rowspan="3" class="NonPrintable" valign="top" width="135" align="right"&gt;             &lt;table style="border-style: none; border-color: -moz-use-text-color; border-width: 0px 1px 1px;" width="135" cellpadding="0" cellspacing="0"&gt; 			&lt;tbody&gt;&lt;tr&gt;			 			&lt;td class="Gadgets" align="center" height="35"&gt;Sponsors&lt;/td&gt;			 			&lt;/tr&gt; 			&lt;tr&gt;			 			&lt;td valign="top" align="left"&gt; 			&lt;script type="text/javascript"&gt;&lt;!-- 			google_ad_client = "pub-9162549217456745"; 			/* 120x600_CD_Vertical, created 6/19/08 */ 			google_ad_slot = "2307071523"; 			google_ad_width = 120; 			google_ad_height = 600; 			//--&gt; 			&lt;/script&gt; 			&lt;script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt; 			&lt;/script&gt;&lt;script src="http://pagead2.googlesyndication.com/pagead/expansion_embed.js"&gt;&lt;/script&gt;&lt;script src="http://googleads.g.doubleclick.net/pagead/test_domain.js"&gt;&lt;/script&gt;&lt;script&gt;google_protectAndRun("ads_core.google_render_ad", google_handleError, google_render_ad);&lt;/script&gt;&lt;ins style="border: medium none ; margin: 0pt; padding: 0pt; display: inline-table; height: 600px; position: relative; visibility: visible; width: 120px;"&gt;&lt;ins style="border: medium none ; margin: 0pt; padding: 0pt; display: block; height: 600px; position: relative; visibility: visible; width: 120px;"&gt;&lt;iframe allowtransparency="true" hspace="0" id="google_ads_frame1" marginheight="0" marginwidth="0" name="google_ads_frame" src="http://googleads.g.doubleclick.net/pagead/ads?client=ca-pub-9162549217456745&amp;amp;dt=1246447398172&amp;amp;lmt=1246447393&amp;amp;output=html&amp;amp;slotname=2307071523&amp;amp;correlator=1246447398172&amp;amp;url=http%3A%2F%2Fwww.codedigest.com%2FArticles%2FASPNET%2F106_GridView_with_Thumbnail_Images_%25E2%2580%2593_Part_2.aspx&amp;amp;ref=http%3A%2F%2Fwww.google.com%2Fsearch%3Fie%3DUTF-8%26oe%3DUTF-8%26sourceid%3Dnavclient%26gfns%3D1%26q%3Dthumb%2Bnail%2Bimages%2Bin%2Bgridview&amp;amp;frm=0&amp;amp;ga_vid=652959834.1246447394&amp;amp;ga_sid=1246447394&amp;amp;ga_hid=595025088&amp;amp;ga_fc=true&amp;amp;flash=10.0.12&amp;amp;w=120&amp;amp;h=600&amp;amp;u_h=720&amp;amp;u_w=1280&amp;amp;u_ah=690&amp;amp;u_aw=1280&amp;amp;u_cd=32&amp;amp;u_tz=330&amp;amp;u_his=1&amp;amp;u_java=true&amp;amp;u_nplug=16&amp;amp;u_nmime=56&amp;amp;dtd=31&amp;amp;xpc=tsJzkznMgO&amp;amp;p=http%3A//www.codedigest.com" style="left: 0pt; position: absolute; top: 0pt;" vspace="0" scrolling="no" width="120" frameborder="0" height="600"&gt;&lt;/iframe&gt;&lt;/ins&gt;&lt;/ins&gt;           	&lt;/td&gt;			 			&lt;/tr&gt;			 		    &lt;/tbody&gt;&lt;/table&gt;        &lt;br /&gt;       &lt;!-- Book Ads --&gt;          &lt;table style="border-style: none; border-color: -moz-use-text-color; border-width: 0px 1px 1px;" width="135" cellpadding="0" cellspacing="0"&gt; 			&lt;tbody&gt;&lt;tr&gt;			 			&lt;td class="Gadgets" align="center" height="35"&gt;Useful Books For Developers&lt;/td&gt;			 			&lt;/tr&gt; 			&lt;tr&gt;			 			&lt;td valign="top" align="left"&gt;               &lt;a id="ctl00_adrBooks" href="http://www.packtpub.com/ajax-csharp-essentials/book/mid/160309tm5q3y" target="_top"&gt;&lt;img src="http://www.codedigest.com/Advertisement/Packt/MS%20AJAX.jpg" alt="Microsoft AJAX Library Essentials: Client-side ASP.NET AJAX 1.0 Explained" style="border-width: 0px;" /&gt;&lt;/a&gt;               &lt;a href="http://www.codedigest.com/Books/BuyBooks.aspx"&gt;More books..&lt;/a&gt;           &lt;/td&gt;			 			&lt;/tr&gt;			 		  &lt;/tbody&gt;&lt;/table&gt;                   &lt;!-- End Book Ads --&gt;                 &lt;br /&gt;             &lt;table style="border-style: none; border-color: -moz-use-text-color; border-width: 0px 1px 1px;" width="135" cellpadding="0" cellspacing="0"&gt; &lt;tbody&gt;&lt;tr&gt;			 &lt;td class="Gadgets" align="center" height="35"&gt;Similar Articles&lt;/td&gt;			 &lt;/tr&gt; &lt;tr&gt;			 &lt;td valign="top" align="left"&gt;        &lt;table id="ctl00_SimilarArticles1_dlSimilarArticles" style="width: 100%; border-collapse: collapse;" border="0" cellspacing="0"&gt; 	&lt;tbody&gt;&lt;tr&gt; 		&lt;td&gt;          &lt;div class="Post"&gt;                     &lt;div class="ArtTitle"&gt;&lt;a id="ctl00_SimilarArticles1_dlSimilarArticles_ctl00_TitleLink" href="http://www.codedigest.com/Articles/ASPNET/153_Custom_Paging_for_GridView_using_LINQ.aspx"&gt;Custom Paging for GridView using LINQ&lt;/a&gt;&lt;/div&gt;                                          &lt;div class="PostInfo"&gt;                         Posted on &lt;span id="ctl00_SimilarArticles1_dlSimilarArticles_ctl00_DatePostedLabel"&gt;6/11/2009 @ 9:09 AM&lt;/span&gt;                         By  &lt;a href="http://www.codedigest.com/AuthorProfile.aspx?AuthorID=5"&gt;&lt;b&gt;&lt;span id="ctl00_SimilarArticles1_dlSimilarArticles_ctl00_lblAuthor"&gt;Satheesh Babu&lt;/span&gt;&lt;/b&gt;&lt;/a&gt;                     &lt;/div&gt;            &lt;/div&gt;            &lt;/td&gt; 	&lt;/tr&gt;&lt;tr&gt; 		&lt;td&gt;          &lt;div class="Post"&gt;                     &lt;div class="ArtTitle"&gt;&lt;a id="ctl00_SimilarArticles1_dlSimilarArticles_ctl01_TitleLink" href="http://www.codedigest.com/Articles/ASPNET/247_DatePicker_Control_in_ASPNet.aspx"&gt;DatePicker Control in ASP.Net&lt;/a&gt;&lt;/div&gt;                                          &lt;div class="PostInfo"&gt;                         Posted on &lt;span id="ctl00_SimilarArticles1_dlSimilarArticles_ctl01_DatePostedLabel"&gt;6/4/2009 @ 6:19 AM&lt;/span&gt;                         By  &lt;a href="http://www.codedigest.com/AuthorProfile.aspx?AuthorID=5"&gt;&lt;b&gt;&lt;span id="ctl00_SimilarArticles1_dlSimilarArticles_ctl01_lblAuthor"&gt;Satheesh Babu&lt;/span&gt;&lt;/b&gt;&lt;/a&gt;                     &lt;/div&gt;            &lt;/div&gt;            &lt;/td&gt; 	&lt;/tr&gt;&lt;tr&gt; 		&lt;td&gt;          &lt;div class="Post"&gt;                     &lt;div class="ArtTitle"&gt;&lt;a id="ctl00_SimilarArticles1_dlSimilarArticles_ctl02_TitleLink" href="http://www.codedigest.com/Articles/ASPNET/245_Using_the_Validator_Controls_in_ASPNet_Projects.aspx"&gt;Using the Validator Controls in ASP.Net Projects&lt;/a&gt;&lt;/div&gt;                                          &lt;div class="PostInfo"&gt;                         Posted on &lt;span id="ctl00_SimilarArticles1_dlSimilarArticles_ctl02_DatePostedLabel"&gt;5/27/2009 @ 8:57 AM&lt;/span&gt;                         By  &lt;a href="http://www.codedigest.com/AuthorProfile.aspx?AuthorID=86"&gt;&lt;b&gt;&lt;span id="ctl00_SimilarArticles1_dlSimilarArticles_ctl02_lblAuthor"&gt;Bala Murugan&lt;/span&gt;&lt;/b&gt;&lt;/a&gt;                     &lt;/div&gt;            &lt;/div&gt;            &lt;/td&gt; 	&lt;/tr&gt;&lt;tr&gt; 		&lt;td&gt;          &lt;div class="Post"&gt;                     &lt;div class="ArtTitle"&gt;&lt;a id="ctl00_SimilarArticles1_dlSimilarArticles_ctl03_TitleLink" href="http://www.codedigest.com/Articles/ASPNET/242_Tips_for_Deploying_ASPNet_Application_in_Production.aspx"&gt;Tips for Deploying ASP.Net Application in Production&lt;/a&gt;&lt;/div&gt;                                          &lt;div class="PostInfo"&gt;                         Posted on &lt;span id="ctl00_SimilarArticles1_dlSimilarArticles_ctl03_DatePostedLabel"&gt;5/15/2009 @ 1:46 AM&lt;/span&gt;                         By  &lt;a href="http://www.codedigest.com/AuthorProfile.aspx?AuthorID=5"&gt;&lt;b&gt;&lt;span id="ctl00_SimilarArticles1_dlSimilarArticles_ctl03_lblAuthor"&gt;Satheesh Babu&lt;/span&gt;&lt;/b&gt;&lt;/a&gt;                     &lt;/div&gt;            &lt;/div&gt;            &lt;/td&gt; 	&lt;/tr&gt;&lt;tr&gt; 		&lt;td&gt;          &lt;div class="Post"&gt;                     &lt;div class="ArtTitle"&gt;&lt;a id="ctl00_SimilarArticles1_dlSimilarArticles_ctl04_TitleLink" href="http://www.codedigest.com/Articles/ASPNET/239_Choosing_the_Right_DataBound_Control_in_ASPNet.aspx"&gt;Choosing the Right DataBound Control in ASP.Net&lt;/a&gt;&lt;/div&gt;                                          &lt;div class="PostInfo"&gt;                         Posted on &lt;span id="ctl00_SimilarArticles1_dlSimilarArticles_ctl04_DatePostedLabel"&gt;4/30/2009 @ 11:24 AM&lt;/span&gt;                         By  &lt;a href="http://www.codedigest.com/AuthorProfile.aspx?AuthorID=5"&gt;&lt;b&gt;&lt;span id="ctl00_SimilarArticles1_dlSimilarArticles_ctl04_lblAuthor"&gt;Satheesh Babu&lt;/span&gt;&lt;/b&gt;&lt;/a&gt;                     &lt;/div&gt;            &lt;/div&gt;            &lt;/td&gt; 	&lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;/td&gt;			 &lt;/tr&gt;			 &lt;/tbody&gt;&lt;/table&gt;             &lt;/td&gt;            &lt;/tr&gt;              &lt;tr&gt;        &lt;td class="NonPrintable"&gt;           &lt;!-- Ads go here --&gt;                       &amp;lt;script language="javascript"&amp;gt;&lt;br /&gt;&lt;br /&gt;function ShowDIV(ImID)&lt;br /&gt;&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;       var obj = document.getElementById("IMGDIV");&lt;br /&gt;&lt;br /&gt;       var im = document.getElementById("imIMG");&lt;br /&gt;&lt;br /&gt;       if ( obj != null )&lt;br /&gt;&lt;br /&gt;       {&lt;br /&gt;&lt;br /&gt;           obj.style.display = "block";&lt;br /&gt;&lt;br /&gt;           im.src = "FullImage.ashx?ImID="+ImID;&lt;br /&gt;&lt;br /&gt;       }    &lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function HideDIV()&lt;br /&gt;&lt;br /&gt;{ &lt;br /&gt;&lt;br /&gt;      var obj = document.getElementById("IMGDIV");&lt;br /&gt;&lt;br /&gt;       if ( obj != null )&lt;br /&gt;&lt;br /&gt;       {&lt;br /&gt;&lt;br /&gt;         obj.style.display = "none";&lt;br /&gt;&lt;br /&gt;       }   &lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;br /&gt;ASPX&lt;br /&gt;&lt;br /&gt;&amp;lt;form id="form1" runat="server"&amp;gt;&lt;br /&gt;&lt;br /&gt;   &amp;lt;div&amp;gt;&lt;br /&gt;&lt;br /&gt;       &amp;lt;asp:GridView Width="500px" ID="gvImages" runat="server" AutoGenerateColumns="False" CellPadding="4" ForeColor="#333333" GridLines="None" &amp;gt;&lt;br /&gt;&lt;br /&gt;           &amp;lt;Columns&amp;gt;&lt;br /&gt;&lt;br /&gt;               &amp;lt;asp:BoundField HeaderText = "Image Name" DataField="imagename" /&amp;gt;&lt;br /&gt;&lt;br /&gt;               &amp;lt;asp:TemplateField HeaderText="Image"&amp;gt;&lt;br /&gt;&lt;br /&gt;                &amp;lt;ItemTemplate&amp;gt;&lt;br /&gt;&lt;br /&gt;                  &amp;lt;a href="javascript:void(ShowDIV('&amp;lt;%# Eval("ImageID")%&amp;gt;'));" &amp;gt; &amp;lt;asp:Image ID="Image1" runat="server" ImageUrl='&amp;lt;%# "ImageHandler.ashx?ImID="+ Eval("ImageID")  %&amp;gt;'/&amp;gt; &amp;lt;/a&amp;gt;&lt;br /&gt;&lt;br /&gt;                &amp;lt;/ItemTemplate&amp;gt;&lt;br /&gt;&lt;br /&gt;           &amp;lt;/asp:TemplateField&amp;gt;            &lt;br /&gt;&lt;br /&gt;           &amp;lt;/Columns&amp;gt;&lt;br /&gt;&lt;br /&gt;           &amp;lt;FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" /&amp;gt;&lt;br /&gt;&lt;br /&gt;           &amp;lt;RowStyle BackColor="#FFFBD6" ForeColor="#333333" /&amp;gt;&lt;br /&gt;&lt;br /&gt;           &amp;lt;SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" /&amp;gt;&lt;br /&gt;&lt;br /&gt;           &amp;lt;PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" /&amp;gt;&lt;br /&gt;&lt;br /&gt;           &amp;lt;HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" /&amp;gt;&lt;br /&gt;&lt;br /&gt;           &amp;lt;AlternatingRowStyle BackColor="White" /&amp;gt;&lt;br /&gt;&lt;br /&gt;       &amp;lt;/asp:GridView&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;   &amp;lt;/div&amp;gt;&lt;br /&gt;&lt;br /&gt;   &amp;lt;div id="IMGDIV" align="center" valign="middle" runat="server" style="position: absolute;left: 35%;top: 25%;display:none;visibility:visible;vertical-align:middle;border-style:inset;border-color:black;background-color:#c8d1d4;"&amp;gt;&lt;br /&gt;&lt;br /&gt;   &amp;lt;table&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;img id="imIMG" /&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt; &amp;lt;input type="button" style="vertical-align:text-top" value="Close" onclick="return HideDIV();" /&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;/table&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;/div&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/form&amp;gt;&lt;br /&gt;&lt;/td&gt;        &lt;/tr&gt;                      &lt;tr&gt;           &lt;td&gt;             &lt;p class="ArticleCode"&gt;&lt;script language="javascript"&gt;&lt;/p&gt; &lt;p class="ArticleCode"&gt;function ShowDIV(ImID)&lt;/p&gt; &lt;p class="ArticleCode"&gt;{&lt;/p&gt; &lt;p class="ArticleCode"&gt;        var obj = document.getElementById("IMGDIV");&lt;/p&gt; &lt;p class="ArticleCode"&gt;        var im = document.getElementById("imIMG");&lt;/p&gt; &lt;p class="ArticleCode"&gt;        if ( obj != null )&lt;/p&gt; &lt;p class="ArticleCode"&gt;        {&lt;/p&gt; &lt;p class="ArticleCode"&gt;            obj.style.display = "block"; &lt;/p&gt; &lt;p class="ArticleCode"&gt;            im.src = "FullImage.ashx?ImID="+ImID;&lt;/p&gt; &lt;p class="ArticleCode"&gt;        }       &lt;/p&gt; &lt;p class="ArticleCode"&gt;}&lt;/p&gt; &lt;p class="ArticleCode"&gt;function HideDIV()&lt;/p&gt; &lt;p class="ArticleCode"&gt;{    &lt;/p&gt; &lt;p class="ArticleCode"&gt;       var obj = document.getElementById("IMGDIV");&lt;/p&gt; &lt;p class="ArticleCode"&gt;        if ( obj != null )&lt;/p&gt; &lt;p class="ArticleCode"&gt;        {&lt;/p&gt; &lt;p class="ArticleCode"&gt;          obj.style.display = "none"; &lt;/p&gt; &lt;p class="ArticleCode"&gt;        }      &lt;/p&gt; &lt;p class="ArticleCode"&gt;}&lt;/p&gt;&lt;span style="font-weight: bold;"&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;ASPX&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;form id="form1" runat="server"&gt;&lt;br /&gt;&lt;br /&gt;   &lt;div&gt;&lt;br /&gt;&lt;br /&gt;       &lt;asp:gridview width="500px" id="gvImages" runat="server" autogeneratecolumns="False" cellpadding="4" forecolor="#333333" gridlines="None"&gt;&lt;br /&gt;&lt;br /&gt;           &lt;columns&gt;&lt;br /&gt;&lt;br /&gt;               &lt;asp:boundfield headertext="Image Name" datafield="imagename"&gt;&lt;br /&gt;&lt;br /&gt;               &lt;asp:templatefield headertext="Image"&gt;&lt;br /&gt;&lt;br /&gt;                &lt;itemtemplate&gt;&lt;br /&gt;&lt;br /&gt;                  &lt;a href="javascript:void(ShowDIV('&lt;%#%20Eval("&gt;'));" &gt; &lt;asp:image id="Image1" runat="server" imageurl="'&lt;%#" imid="+ Eval("&gt;'/&gt; &lt;/asp:image&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;                &lt;/itemtemplate&gt;&lt;br /&gt;&lt;br /&gt;           &lt;/asp:templatefield&gt;            &lt;br /&gt;&lt;br /&gt;           &lt;/asp:boundfield&gt;&lt;br /&gt;&lt;br /&gt;           &lt;footerstyle backcolor="#990000" bold="True" forecolor="White"&gt;&lt;br /&gt;&lt;br /&gt;           &lt;rowstyle backcolor="#FFFBD6" forecolor="#333333"&gt;&lt;br /&gt;&lt;br /&gt;           &lt;selectedrowstyle backcolor="#FFCC66" bold="True" forecolor="Navy"&gt;&lt;br /&gt;&lt;br /&gt;           &lt;pagerstyle backcolor="#FFCC66" forecolor="#333333" horizontalalign="Center"&gt;&lt;br /&gt;&lt;br /&gt;           &lt;headerstyle backcolor="#990000" bold="True" forecolor="White"&gt;&lt;br /&gt;&lt;br /&gt;           &lt;alternatingrowstyle backcolor="White"&gt;&lt;br /&gt;&lt;br /&gt;       &lt;/alternatingrowstyle&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;   &lt;/headerstyle&gt;&lt;/pagerstyle&gt;&lt;/selectedrowstyle&gt;&lt;/rowstyle&gt;&lt;/footerstyle&gt;&lt;/columns&gt;&lt;/asp:gridview&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;   &lt;div id="IMGDIV" valign="middle" runat="server" style="border-style: inset; border-color: black; position: absolute; left: 35%; top: 25%; display: none; visibility: visible; vertical-align: middle; background-color: rgb(200, 209, 212);" align="center"&gt;&lt;br /&gt;&lt;br /&gt;   &lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="" id="imIMG" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt; &lt;input style="vertical-align: text-top;" value="Close" onclick="return HideDIV();" type="button"&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;  &lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;/form&gt;&lt;p class="MsoNormal"&gt;&lt;span lang="EN-AU"&gt;&lt;/span&gt; &lt;/p&gt; &lt;p class="ArticleContent"&gt;When we execute the page we will get an output similar  to below.&lt;/p&gt; &lt;p class="MsoNormal"&gt;&lt;span lang="EN-AU"&gt;&lt;img src="http://www.codedigest.com/Articles/ArticleFiles/IMG/106/image001.jpg" width="408" border="0" height="296" /&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="ArticleContent"&gt;On clicking the thumbnail image, we can view the full  image inside a DIV tag like below,&lt;/p&gt; &lt;p class="MsoNormal"&gt;&lt;b&gt;&lt;span lang="EN-AU"&gt;&lt;img src="http://www.codedigest.com/Articles/ArticleFiles/IMG/106/image002.jpg" width="408" border="0" height="256" /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt; &lt;p class="MsoNormal"&gt;&lt;b&gt;&lt;i&gt;&lt;span lang="EN-AU"&gt;&lt;/span&gt;&lt;/i&gt;&lt;/b&gt; &lt;/p&gt; &lt;p class="ArticleContent"&gt;&lt;span lang="EN-AU"&gt; &lt;/span&gt;Clicking Close button will  close the image, in other words it closes the DIV tag.&lt;/p&gt; &lt;p class="MsoNormal"&gt;&lt;span lang="EN-AU"&gt;&lt;/span&gt; &lt;/p&gt; &lt;p class="ArticleSubtitle"&gt;Note&lt;/p&gt; &lt;p class="ArticleContent"&gt;The source code attached with this article has a page  for uploading images. Create a table with name Image with columns  ImageID(Identity), ImageName(Varchar(50)) and Image(image). Configure the  connection string in the web.config file corresponding to the sqlserver you  use.&lt;/p&gt;            &lt;/td&gt;             &lt;/tr&gt;       &lt;/tbody&gt;&lt;/table&gt;       &lt;!-- change --&gt;       &lt;/td&gt;       &lt;/tr&gt;         &lt;!-- change --&gt;       &lt;tr&gt;       &lt;td class="NonPrintable" width="40%"&gt; 					&lt;script type="text/javascript"&gt;&lt;!-- 			google_ad_client = "pub-9162549217456745"; 			/* 336x280_CodeDigest_Article, created 9/13/08 */ 			google_ad_slot = "5989194439"; 			google_ad_width = 336; 			google_ad_height = 280; 			//--&gt; 			&lt;/script&gt; 			&lt;script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt; 			&lt;/script&gt;&lt;script&gt;google_protectAndRun("ads_core.google_render_ad", google_handleError, google_render_ad);&lt;/script&gt;&lt;ins style="border: medium none ; margin: 0pt; padding: 0pt; display: inline-table; height: 280px; position: relative; visibility: visible; width: 336px;"&gt;&lt;ins style="border: medium none ; margin: 0pt; padding: 0pt; display: block; height: 280px; position: relative; visibility: visible; width: 336px;"&gt;&lt;iframe allowtransparency="true" hspace="0" id="google_ads_frame2" marginheight="0" marginwidth="0" name="google_ads_frame" src="http://googleads.g.doubleclick.net/pagead/ads?client=ca-pub-9162549217456745&amp;amp;dt=1246447398327&amp;amp;lmt=1246447393&amp;amp;prev_slotnames=2307071523&amp;amp;output=html&amp;amp;slotname=5989194439&amp;amp;correlator=1246447398172&amp;amp;url=http%3A%2F%2Fwww.codedigest.com%2FArticles%2FASPNET%2F106_GridView_with_Thumbnail_Images_%25E2%2580%2593_Part_2.aspx&amp;amp;ref=http%3A%2F%2Fwww.google.com%2Fsearch%3Fie%3DUTF-8%26oe%3DUTF-8%26sourceid%3Dnavclient%26gfns%3D1%26q%3Dthumb%2Bnail%2Bimages%2Bin%2Bgridview&amp;amp;frm=0&amp;amp;ga_vid=652959834.1246447394&amp;amp;ga_sid=1246447394&amp;amp;ga_hid=595025088&amp;amp;ga_fc=true&amp;amp;flash=10.0.12&amp;amp;w=336&amp;amp;h=280&amp;amp;u_h=720&amp;amp;u_w=1280&amp;amp;u_ah=690&amp;amp;u_aw=1280&amp;amp;u_cd=32&amp;amp;u_tz=330&amp;amp;u_his=1&amp;amp;u_java=true&amp;amp;u_nplug=16&amp;amp;u_nmime=56&amp;amp;dtd=3&amp;amp;xpc=qmEnEkQJxu&amp;amp;p=http%3A//www.codedigest.com" style="left: 0pt; position: absolute; top: 0pt;" vspace="0" scrolling="no" width="336" frameborder="0" height="280"&gt;&lt;/iframe&gt;&lt;/ins&gt;&lt;/ins&gt;       &lt;p&gt;&lt;/p&gt;&lt;/td&gt;       &lt;td valign="middle" width="60%"&gt;        &lt;p class="ArticleSubtitle"&gt;Download&lt;/p&gt; &lt;p class="MsoNormal"&gt;&lt;span lang="EN-AU"&gt;&lt;a href="http://www.codedigest.com/Articles/ArticleFiles/ZIPS/106.zip"&gt;Source  Code&lt;/a&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal"&gt;&lt;span lang="EN-AU"&gt;&lt;/span&gt; &lt;/p&gt; &lt;p class="ArticleSubtitle"&gt;Conclusion&lt;/p&gt; &lt;p class="ArticleContent"&gt;When we bind the images of different dimensions stored  in database to a gridview it will give an inconsistent look to the gridview.  This article will address this issue by creating a thumbnail image for the  images and then binding it to a gridview. Thus, displaying the full image inside  a DIV tag will give a better user experience when compared to popup window.&lt;/p&gt; &lt;p class="ArticleContent"&gt;Happy Coding!!!&lt;/p&gt; &lt;p class="MsoNormal"&gt;&lt;span lang="EN-AU"&gt;&lt;/span&gt; &lt;/p&gt;  &lt;/td&gt;       &lt;/tr&gt;       &lt;tr&gt;       &lt;td colspan="2"&gt;            &lt;table width="100%" bgcolor="#f5f5f5"&gt; &lt;tbody&gt;&lt;tr&gt; &lt;td align="center"&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4926429223536207631-6906590840393129621?l=sudag.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudag.blogspot.com/feeds/6906590840393129621/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4926429223536207631&amp;postID=6906590840393129621' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/6906590840393129621'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/6906590840393129621'/><link rel='alternate' type='text/html' href='http://sudag.blogspot.com/2009/07/gridview-with-thumbnail-images-part-2.html' title='GridView with Thumbnail Images'/><author><name>suda</name><uri>http://www.blogger.com/profile/15635297681991446902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4926429223536207631.post-6807265139556452473</id><published>2009-06-29T03:22:00.000-07:00</published><updated>2009-06-29T03:54:21.128-07:00</updated><title type='text'>Hidden Columns with values: asp:GridView (access the value of the hidden columns in gridview )</title><content type='html'>If you set Column Visible property to false, this column won't rendered. But if you want these values available, What will you do?&lt;br /&gt;&lt;br /&gt;My trick was, set HeaderText to empty, convert the BoundField in TemplateField, and use a HiddenField control. The effect the column won't be visible. Also you can use the controls array to access to value property.&lt;br /&gt;&lt;br /&gt;&amp;lt;columns&amp;gt;&amp;lt;asp:boundfield datafield="CompanyCode" headertext="Company" sortexpression="CompanyCode"&amp;gt;&lt;br /&gt;...&lt;br /&gt;&amp;lt;columns&amp;gt;&lt;br /&gt;&amp;lt;asp:templatefield&amp;gt;&amp;lt;itemtemplate&amp;gt;&amp;lt;asp:hiddenfield id="hf1" value=""&amp;gt;"&amp;gt;&lt;br /&gt;runat="server"&amp;gt;&amp;lt;/asp:hiddenfield&amp;gt;&amp;lt;/itemtemplate&amp;gt;&lt;br /&gt;...&lt;br /&gt;// accesing the value property&lt;br /&gt;int tmpID =&lt;br /&gt;Convert.ToInt32(((HiddenField)GridView1.SelectedRow.Cells[3].Controls[1]).Value); &amp;lt;/asp:templatefield&amp;gt;&amp;lt;/columns&amp;gt;&amp;lt;/asp:boundfield&amp;gt;&amp;lt;/columns&amp;gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4926429223536207631-6807265139556452473?l=sudag.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudag.blogspot.com/feeds/6807265139556452473/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4926429223536207631&amp;postID=6807265139556452473' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/6807265139556452473'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/6807265139556452473'/><link rel='alternate' type='text/html' href='http://sudag.blogspot.com/2009/06/hidden-columns-with-values-aspgridview.html' title='Hidden Columns with values: asp:GridView (access the value of the hidden columns in gridview )'/><author><name>suda</name><uri>http://www.blogger.com/profile/15635297681991446902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4926429223536207631.post-6216164551801481700</id><published>2009-06-23T06:45:00.000-07:00</published><updated>2009-06-23T06:46:21.714-07:00</updated><title type='text'>How to add link to a css file in content page</title><content type='html'>Try this&lt;p&gt;In VB &lt;/p&gt;&lt;p&gt;  &lt;/p&gt;&lt;pre class="coloredcode"&gt;&lt;span class="kwd"&gt;Protected Sub&lt;/span&gt; Page_Init(&lt;span class="kwd"&gt;ByVal&lt;/span&gt; sender &lt;span class="kwd"&gt;As Object&lt;/span&gt;, &lt;span class="kwd"&gt;ByVal&lt;/span&gt; e &lt;span class="kwd"&gt;As&lt;/span&gt; System.EventArgs) &lt;span class="kwd"&gt;Handles Me&lt;/span&gt;.Init&lt;br /&gt;   &lt;span class="kwd"&gt;Dim&lt;/span&gt; css &lt;span class="kwd"&gt;As&lt;/span&gt; HtmlGenericControl&lt;br /&gt;   css = &lt;span class="kwd"&gt;New&lt;/span&gt; HtmlGenericControl&lt;br /&gt;   css.TagName = &lt;span class="st"&gt;"style"&lt;/span&gt;&lt;br /&gt;   css.Attributes.Add(&lt;span class="st"&gt;"type"&lt;/span&gt;, &lt;span class="st"&gt;"text/css"&lt;/span&gt;)&lt;br /&gt;   css.InnerHtml = &lt;span class="st"&gt;"@import ""/foobar.css"";"&lt;/span&gt;&lt;br /&gt;   Page.Header.Controls.Add(css)&lt;br /&gt;&lt;span class="kwd"&gt;End Sub&lt;/span&gt;&lt;/pre&gt; &lt;p&gt;In C#&lt;/p&gt;&lt;p&gt;  &lt;/p&gt;&lt;pre class="coloredcode"&gt;&lt;span class="kwd"&gt;protected void&lt;/span&gt; Page_Init(&lt;span class="kwd"&gt;object&lt;/span&gt; sender, System.EventArgs e)&lt;br /&gt;{&lt;br /&gt;   HtmlGenericControl css;&lt;br /&gt;   css = &lt;span class="kwd"&gt;new&lt;/span&gt; HtmlGenericControl();&lt;br /&gt;   css.TagName = &lt;span class="st"&gt;"style"&lt;/span&gt;;&lt;br /&gt;   css.Attributes.Add(&lt;span class="st"&gt;"type"&lt;/span&gt;, &lt;span class="st"&gt;"text/css"&lt;/span&gt;);&lt;br /&gt;   css.InnerHtml = &lt;span class="st"&gt;"@import \"&lt;/span&gt;/foobar.css\&lt;span class="st"&gt;";"&lt;/span&gt;;&lt;br /&gt;   Page.Header.Controls.Add(css);&lt;br /&gt;}&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4926429223536207631-6216164551801481700?l=sudag.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudag.blogspot.com/feeds/6216164551801481700/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4926429223536207631&amp;postID=6216164551801481700' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/6216164551801481700'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/6216164551801481700'/><link rel='alternate' type='text/html' href='http://sudag.blogspot.com/2009/06/how-to-add-link-to-css-file-in-content.html' title='How to add link to a css file in content page'/><author><name>suda</name><uri>http://www.blogger.com/profile/15635297681991446902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4926429223536207631.post-2620862795109448160</id><published>2009-06-23T04:13:00.001-07:00</published><updated>2009-06-23T04:13:40.364-07:00</updated><title type='text'>How To Validate a Serial Number During an Installation Created with VSI</title><content type='html'>&lt;h1 class="title"&gt;How To Validate a Serial Number During an Installation Created with VSI&lt;/h1&gt;&lt;div id="kb_expandcollapseall" class="expandcollapseall_open"&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt; if (kb_page_object)                     {                     kb_page_object.kb_imageExpandHoverText = 'Click to expand this image';                     }                 &lt;/script&gt;&lt;/div&gt;&lt;h2 class="subTitle" id="tocHeadRef"&gt;&lt;span&gt;&lt;a href="javascript:void(0);"&gt;SUMMARY&lt;/a&gt;&lt;/span&gt;&lt;div class="sectionpreview_closed"&gt;In a Visual Studio Installer (VSI) project, the developer has the ability to ad...&lt;/div&gt;&lt;/h2&gt;&lt;script type="text/javascript"&gt;                             loadTOCNode(1, 'summary');                         &lt;/script&gt;&lt;div style="margin-left: 195px;" class="sbody"&gt; In a Visual Studio Installer (VSI) project, the developer has the ability to add a &lt;b&gt;Customer Information&lt;/b&gt; dialog box in the user interface. By default, this dialog box has an input field for a serial number. Visual Studio Installer provides minimal support for validating this field. This article provides the steps necessary to include custom code to validate the serial number that is entered by the user. These steps include using the Windows Installer SDK tool Orca, and creating a DLL for which sample code is provided.&lt;br /&gt;&lt;br /&gt;To download the Orca tool, see the following MSDN Web site that includes samples, tools, and documentation for the Windows Installer &lt;div class="indent"&gt;&lt;span class="ll"&gt;&lt;a href="http://msdn.microsoft.com/downloads/default.asp?URL=/code/sample.asp?url=/msdn-files/027/001/457/msdncompositedoc.xml"&gt; http://msdn.microsoft.com/downloads/default.asp?URL=/code/sample.asp?url=/msdn-files/027/001/457/msdncompositedoc.xml &lt;/a&gt;&lt;/span&gt;&lt;span class="pLink"&gt; (http://msdn.microsoft.com/downloads/default.asp?URL=/code/sample.asp?url=/msdn-files/027/001/457/msdncompositedoc.xml)  &lt;/span&gt;&lt;span class="kb_space"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="topOfPage"&gt;&lt;a href="http://support.microsoft.com/kb/253683/en-us#top"&gt;&lt;img src="http://support.microsoft.com/library/images/support/kbgraphics/public/en-us/uparrow.gif" alt="" /&gt;Back to the top&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;h2 class="subTitle" id="tocHeadRef"&gt;&lt;span&gt;&lt;a href="javascript:void(0);"&gt;MORE INFORMATION&lt;/a&gt;&lt;/span&gt;&lt;div class="sectionpreview_closed"&gt;Create an empty installer project with VSI.Add a Customer Information dialog box...&lt;/div&gt;&lt;/h2&gt;&lt;script type="text/javascript"&gt;                             loadTOCNode(1, 'moreinformation');                         &lt;/script&gt;&lt;ol&gt;&lt;li&gt;Create an empty installer project with VSI.&lt;/li&gt;&lt;li&gt;Add a &lt;b&gt;Customer Information&lt;/b&gt; dialog box to the user interface.  Do not change the default properties for the dialog box.&lt;/li&gt;&lt;li&gt;Build the project.&lt;/li&gt;&lt;li&gt;Create a custom action DLL. &lt;b&gt;NOTE&lt;/b&gt;: You cannot use an EXE custom action because this custom action sets a property and that can only be accomplished by using a DLL, which has a handle to the installation.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;On the Tools menu, click the &lt;b&gt;Options Directories&lt;/b&gt; tab in your DLL project, and then add the path to the Windows Installer SDK's &lt;b&gt;Include&lt;/b&gt; and &lt;b&gt;Lib&lt;/b&gt; directories.&lt;/li&gt;&lt;li&gt;In the &lt;b&gt;Project Settings&lt;/b&gt; dialog box, add msi.lib to the library list. Use either a .DEF file or the __declspec(dllimport) attribute to export the DLL functions. Note that the &lt;b&gt;PIDKEY&lt;/b&gt; property has the value of "XXX -XXXXXXX" where X is a number and there is both a space and hyphen. The following sample code uses a string comparison to determine if the serial number is valid:&lt;div class="kb_codebody"&gt;&lt;div class="kb_codecontent"&gt;&lt;code&gt;&lt;/code&gt;&lt;pre class="code"&gt;UINT __stdcall VerifyPID(MSIHANDLE hInstall)&lt;br /&gt;{&lt;br /&gt;  // Local variables  &lt;br /&gt;  UINT    nRetVal = 0;  &lt;br /&gt;  UINT    uiMsiRc;  &lt;br /&gt;  TCHAR   szPidKey[MAX_PATH];  &lt;br /&gt;  DWORD   dwBuffer;   &lt;br /&gt;&lt;br /&gt;  dwBuffer = sizeof(szPidKey)/sizeof(TCHAR);    &lt;br /&gt;&lt;br /&gt;  // First Step - Get the PIDKEY property  &lt;br /&gt;  uiMsiRc = MsiGetProperty(hInstall, TEXT("PIDKEY"), szPidKey, &amp;amp;dwBuffer);&lt;br /&gt;&lt;br /&gt;  if (ERROR_SUCCESS != uiMsiRc)&lt;br /&gt;  {&lt;br /&gt;     MessageBox(NULL, "PIDKEY", "Not able to retrieve PIDKEY property", MB_OK | MB_ICONEXCLAMATION);&lt;br /&gt;     return 0;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  //Insert code to check PIDKEY here&lt;br /&gt;  int str = lstrcmp(szPidKey, "123 -4567890");&lt;br /&gt;&lt;br /&gt;  //If PIDKEY passes check&lt;br /&gt;  if (str == 0)&lt;br /&gt;     MsiSetProperty(hInstall, "PIDCHECK", "TRUE");&lt;br /&gt;  //If PIDKEY doesn't pass check&lt;br /&gt;  else&lt;br /&gt;  {&lt;br /&gt;     MsiSetProperty(hInstall, "PIDCHECK", "FALSE");&lt;br /&gt;     wsprintf(szText, "Please enter the correct code");&lt;br /&gt;     MessageBox(NULL, szText, "PIDCHECK", MB_OK | MB_ICONINFORMATION);&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  return 0;&lt;br /&gt;}&lt;br /&gt;     &lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;Open the Microsoft Windows installer package (.msi) file that you built with VSI in Orca.&lt;/li&gt;&lt;li&gt;Add the DLL to the Binary table and name it &lt;b&gt;VerifyPIDDll&lt;/b&gt;.&lt;/li&gt;&lt;li&gt;Add a new custom action to the Custom Action Table:&lt;div class="indent"&gt; Name - MyPIDChecker;&lt;br /&gt; Type - 1; Source - VerifyPIDDll; Target - VerifyPID &lt;/div&gt;&lt;/li&gt;&lt;li&gt;In the ControlEvent table, find the UserNameForm, which corresponds to the &lt;b&gt;Customer Information&lt;/b&gt; dialog box from VSI. Make all changes to the existing rows with &lt;b&gt;UserNameForm&lt;/b&gt; in the Dialog column and &lt;b&gt;Next&lt;/b&gt; in the Control column: &lt;ol&gt;&lt;li type="a"&gt;Replace the &lt;b&gt;ValidateProductID&lt;/b&gt; Event with &lt;b&gt;DoAction&lt;/b&gt;.  On the same row, replace the Argument &lt;b&gt;{}&lt;/b&gt; with &lt;b&gt;MyPIDChecker&lt;/b&gt;.&lt;/li&gt;&lt;li type="a"&gt;Make sure that the value for the Condition column in the row with the &lt;b&gt;EndDialog&lt;/b&gt; event is:&lt;div class="indent"&gt;&lt;b&gt;UserNameForm_NextArgs="" AND UserNameForm_ShowSerial=""&lt;/b&gt;&lt;/div&gt;&lt;/li&gt;&lt;li type="a"&gt;Using the &lt;b&gt;PIDCHECK&lt;/b&gt; property which was set in the precious sample code, make sure that the value for the Condition column in the row with the &lt;b&gt;NewDialog&lt;/b&gt; event is:&lt;div class="indent"&gt;&lt;b&gt;(PIDCHECK="TRUE") AND UserNameForm_NextArgs&lt;&gt;"" AND UserNameForm_ShowSerial&lt;&gt;""&lt;/b&gt;&lt;/div&gt;&lt;/li&gt;&lt;li type="a"&gt;Make sure that the value for the Condition column in the row with the &lt;b&gt;[UserNameForm_ShowSerialDisabled]&lt;/b&gt; event is:&lt;div class="indent"&gt;&lt;b&gt;PIDCHECK="TRUE"&lt;/b&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;li&gt;Save the .msi file and run the installation.&lt;/li&gt;&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4926429223536207631-2620862795109448160?l=sudag.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudag.blogspot.com/feeds/2620862795109448160/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4926429223536207631&amp;postID=2620862795109448160' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/2620862795109448160'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/2620862795109448160'/><link rel='alternate' type='text/html' href='http://sudag.blogspot.com/2009/06/how-to-validate-serial-number-during.html' title='How To Validate a Serial Number During an Installation Created with VSI'/><author><name>suda</name><uri>http://www.blogger.com/profile/15635297681991446902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4926429223536207631.post-5696518944366029308</id><published>2009-06-23T04:08:00.000-07:00</published><updated>2009-06-23T04:10:24.957-07:00</updated><title type='text'>Deploy your Application or Component Using Windows Installer and serial key</title><content type='html'>&lt;h2&gt;Introduction&lt;/h2&gt; When ever we heard about deployment of our application or component we get scared with the traditional scripted setup programs. The main goal of this article is to make .NET programmers to get used to this easy to setup program which allows you to deploy your application even if you don't know how to write the setup script. Microsoft Dot Net Setup &amp;amp; Deployment will make the setup for you with simple clicks. It is also provided with self taught easy driven wizards. Many programmers who are using Microsoft Visual Studio Dot Net they are not fully aware of this windows installer that comes with Visual Studio; they are going for other setup programs that need's hard scripting knowledge. Using Windows Installer is very easy. &lt;h3&gt;About Microsoft Windows Installer&lt;/h3&gt; Windows Installer enables you to deploy your Applications and Components in an efficient manner. The installer provides new capabilities to advertise features without installing them, to install products on demand, and to add user customizations. Windows Installer is an installation and configuration service that reduces the total cost of ownership. The installer enables customers to better address corporate deployment and provide a standard format for component management. &lt;h3&gt;Run-Time Requirements&lt;/h3&gt; This technology is available as a redistributable for Windows Installer version 2.0, from the &lt;a href="http://www.microsoft.com/downloads" target="_blank"&gt;Microsoft Downloads&lt;/a&gt;.  &lt;h2&gt;Features of Windows Installer:&lt;/h2&gt; &gt; It is based on a data-driven model that provides all installation data and instructions in a single package. In contrast, traditional scripted setup programs. &gt; It also supports self-repair � the ability for an application to automatically reinstall. &gt; It provides the ability to roll back an installation. The deployment tools in Visual Studio .NET build on the foundation of Windows Installer, providing you with rich capabilities for rapidly deploying and maintaining applications built with Visual Studio .NET. Creating your first Deployment Project Visual Studio provides templates for four types of deployment projects: &lt;strong&gt;Setup Project &lt;/strong&gt;Builds an installer for a Windows-based application. &lt;strong&gt;Merge Module Project (.msm) &lt;/strong&gt;is used to pack components that might be shared by multiple applications. &lt;strong&gt;Web Setup Project&lt;/strong&gt; Builds an installer for a Web application. &lt;strong&gt;Cab Project (.cab) &lt;/strong&gt;Creates a cabinet file for downloading to a legacy Web Browser In addition, a Setup wizard is provided to help step you through the process of creating deployment projects. &lt;ul type="disc"&gt;&lt;li&gt;For a Setup project, the installer will install files into a Program Files directory on a target computer. &lt;/li&gt;&lt;li&gt;For a Web Setup project, the installer will install files into a Virtual Root directory on a Web server. &lt;/li&gt;&lt;/ul&gt; &lt;strong&gt;Note&lt;/strong&gt; If you have created a standard deployment project and later decide to deploy it to a Web, you will need to create a new project. &lt;h2&gt;Five Easy Steps:&lt;/h2&gt;  &lt;h3&gt;Step 1&lt;/h3&gt;  &lt;p&gt;Open the Visual Studio IDE, and select File-&gt;New -&gt;Setup and Deployment Projects. Select the Setup Wizard. Give the File name and location where to store that project as shown in the below figure. &lt;/p&gt;  &lt;p&gt;&lt;img src="http://www.codeproject.com/KB/install/easysetup/NewProjDialog.jpg" /&gt; &lt;/p&gt;  &lt;h3&gt;Step 2&lt;/h3&gt;  &lt;p&gt;Welcome to Setup Project Wizard will appear. It is a simple Four Steps Wizard. Click on the Next Button. In the second step on the wizard it will ask the type of the setup. Choose appropriate here I has chosen setup for windows application and click Next. &lt;/p&gt;  &lt;p&gt;&lt;img src="http://www.codeproject.com/KB/install/easysetup/wizardStep1.jpg" /&gt; &lt;/p&gt;  &lt;h3&gt;Step 3&lt;/h3&gt;  &lt;p&gt;&lt;strong&gt;&lt;img src="http://www.codeproject.com/KB/install/easysetup/wizardStep3.jpg" /&gt;&lt;/strong&gt; &lt;/p&gt;  &lt;p&gt;In the third step of this wizard it will ask to add your developed application or component and other files that you need to place in the clients machine, for example say documentation files &lt;/p&gt;  &lt;p&gt;&lt;img src="http://www.codeproject.com/KB/install/easysetup/wizardStep4.jpg" /&gt; &lt;/p&gt;  &lt;p&gt;Now It will display as shown below figure. &lt;/p&gt;  &lt;p&gt;&lt;img src="http://www.codeproject.com/KB/install/easysetup/screen1.jpg" /&gt; &lt;/p&gt;  &lt;h3&gt;Step 4&lt;/h3&gt; As you can see in above figure, The application folder is the folder where your application and supported files will be installed. User's Desktop and Programs Menu are the clients desktop and programs menus respectively. If Place the short files of your main application &amp;amp; Help files on the user's desktop and programs menu, then during the installation the application, supported files and the shortcuts will be placed automatically as you directed by placing the intended files in Application, User Desktop directories and programs menu. &lt;p&gt;  &lt;/p&gt;&lt;h3&gt;  &lt;/h3&gt;&lt;h3&gt;We can use the following editors during the deployment of our application&lt;/h3&gt;  &lt;p&gt;You can find these editiors in the solution explorer each as a button as shown below,&lt;/p&gt;  &lt;p&gt;&lt;img src="http://www.codeproject.com/KB/install/easysetup/Editior.jpg" width="199" height="44" /&gt; &lt;/p&gt;  &lt;h4&gt;File System Editor:&lt;/h4&gt; It allows you to add project outputs, files, and other items to a deployment project and specify where they will be installed on the target computer. &lt;h4&gt;Registry Settings Management Editor:&lt;/h4&gt; Allows you to specify registry keys and values to be added to the registry of the target computer.  &lt;h4&gt;File Types Management Editor :&lt;/h4&gt; It is used to establish file associations on the target computer.  &lt;h4&gt;Custom Actions Management Editor&lt;/h4&gt; Allows you to specify additional actions to be performed on the target computer at the end of an installation.  &lt;h4&gt;Launch Condition Management Editor :&lt;/h4&gt;  &lt;p&gt;Allows you to specify conditions that must be met in order to successfully run an installation. &lt;/p&gt;  &lt;h4&gt;User Interface Management Editor&lt;/h4&gt;  &lt;p&gt;&lt;img style="left: 10px; top: 3829px;" src="http://www.codeproject.com/KB/install/easysetup/screen2.jpg" /&gt;&lt;/p&gt;  &lt;p&gt;As shown in above figure, User InterfaceManagement Editor is used to specify and set properties for predefined dialog boxes that are displayed duging the installation on the target system. &lt;/p&gt;  &lt;p&gt;&lt;img src="http://www.codeproject.com/KB/install/easysetup/serialkey.jpg" /&gt;&lt;/p&gt;  &lt;p&gt;The Customer Information Dialog is important to protect your software.&lt;/p&gt;  &lt;p&gt;for that first set the Show SerialNumber property to true ( false by default).&lt;/p&gt;  &lt;p&gt;there will be a template for the serial key called SerialNumberTemplate:-&lt;/p&gt;  &lt;p&gt;Valid editable characters for the &lt;strong&gt;SerialNumberTemplate&lt;/strong&gt; property are:&lt;/p&gt;  &lt;div class="labelheading"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/div&gt;  &lt;div class="tableSection"&gt; &lt;table width="100%" cellpadding="5" cellspacing="2"&gt; &lt;tbody&gt; &lt;tr&gt; &lt;th&gt;Character &lt;/th&gt;  &lt;th&gt;Meaning &lt;/th&gt; &lt;/tr&gt;  &lt;tr&gt; &lt;td&gt; &lt;p&gt;#&lt;/p&gt; &lt;/td&gt;  &lt;td&gt; &lt;p&gt;Requires a digit that will not be included in the validation algorithm.&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt;  &lt;tr&gt; &lt;td&gt; &lt;p&gt;%&lt;/p&gt; &lt;/td&gt;  &lt;td&gt; &lt;p&gt;Requires a digit that will be included in the validation algorithm.&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt;  &lt;tr&gt; &lt;td&gt; &lt;p&gt;?&lt;/p&gt; &lt;/td&gt;  &lt;td&gt; &lt;p&gt;Requires an alphanumeric character that will not be included in the validation algorithm.&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt;  &lt;tr&gt; &lt;td&gt; &lt;p&gt;^&lt;/p&gt; &lt;/td&gt;  &lt;td&gt; &lt;p&gt;Requires an uppercase or lowercase character. Numeric digits are not valid here.&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt;  &lt;tr&gt; &lt;td&gt; &lt;p&gt;&lt;&lt;/p&gt; &lt;/td&gt;  &lt;td&gt; &lt;p&gt;Any characters to the left of this character will not be visible in the dialog box.&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt;  &lt;tr&gt; &lt;td&gt; &lt;p&gt;&gt;&lt;/p&gt; &lt;/td&gt;  &lt;td&gt; &lt;p&gt;Any characters to the right of this character will not be visible in the dialog box. Required as a terminator if the &lt;&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;/div&gt;  &lt;p&gt;note that any other character is treated as a literal constant.&lt;/p&gt;  &lt;p&gt;The Default template is &lt;###-%%%%%%%&gt;, Which create two text boxes separated by a dash surrounded by spaces. &lt;/p&gt;  &lt;p&gt;The first has # which means that use must enter three numbers but those numbers will not be participating in the validation algorithm. &lt;/p&gt;  &lt;p&gt;The Second box had seven digits,&lt;/p&gt;  &lt;p&gt;% means that it will be involving in the validation. we apply modulo 7 to the sum of these required digits and if it equate to 0 algorithm returns true and the user can proceed to next dialog box. &lt;/p&gt;  &lt;p&gt;Example:-&lt;/p&gt;  &lt;p&gt;&lt;###-%%%%%%%&gt;, &lt;/p&gt;  &lt;p&gt;124 - 7134501 is one of the key by which the user can proceed to next dialog box.&lt;/p&gt;  &lt;p&gt;the first three digits 1, 2 and 4 can be any digits as they will not participate in validation.&lt;/p&gt;  &lt;p&gt;the next seven digits 7134501 when you sum them you will get 21 and if you apply 21%7 you will get 0 so this is ok. Like wise you have to proceed.&lt;/p&gt;  &lt;p&gt;You can add the dialog boxes like end user license agreement dialog and serial key dialog as shown. &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Step 5&lt;/strong&gt;&lt;/p&gt; When you build the application, you will find the install program for your software or component in the projects debug directory. &lt;h2&gt;Conclusion&lt;/h2&gt; I hope that many of the .Net developers who are using traditional setup script programs will find this as a easy and simple way to deploy your software. More than that if you got the licensed Visual Studio .Net with you then there is no need to purchase setup applications from other companies as Visual Studio .Net itself offers it for you. I think that I had given enough features of Windows Installer that comes with Visual Studio .Net. Now it's time that you try it just once to get used to it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4926429223536207631-5696518944366029308?l=sudag.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudag.blogspot.com/feeds/5696518944366029308/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4926429223536207631&amp;postID=5696518944366029308' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/5696518944366029308'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/5696518944366029308'/><link rel='alternate' type='text/html' href='http://sudag.blogspot.com/2009/06/deploy-your-application-or-component.html' title='Deploy your Application or Component Using Windows Installer and serial key'/><author><name>suda</name><uri>http://www.blogger.com/profile/15635297681991446902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4926429223536207631.post-5967892471749550293</id><published>2009-06-10T23:31:00.000-07:00</published><updated>2009-06-10T23:37:33.346-07:00</updated><title type='text'>Javascript function to make asp.net control invisible</title><content type='html'>&lt;meta equiv="Content-Type" content="text/html; charset=utf-8"&gt;&lt;meta name="ProgId" content="Word.Document"&gt;&lt;meta name="Generator" content="Microsoft Word 12"&gt;&lt;meta name="Originator" content="Microsoft Word 12"&gt;&lt;link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CGopinath%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml"&gt;&lt;link rel="themeData" href="file:///C:%5CDOCUME%7E1%5CGopinath%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx"&gt;&lt;link rel="colorSchemeMapping" href="file:///C:%5CDOCUME%7E1%5CGopinath%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml"&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:trackmoves/&gt;   &lt;w:trackformatting/&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:donotpromoteqf/&gt;   &lt;w:lidthemeother&gt;EN-US&lt;/w:LidThemeOther&gt;   &lt;w:lidthemeasian&gt;X-NONE&lt;/w:LidThemeAsian&gt;   &lt;w:lidthemecomplexscript&gt;X-NONE&lt;/w:LidThemeComplexScript&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;    &lt;w:splitpgbreakandparamark/&gt;    &lt;w:dontvertaligncellwithsp/&gt;    &lt;w:dontbreakconstrainedforcedtables/&gt;    &lt;w:dontvertalignintxbx/&gt;    &lt;w:word11kerningpairs/&gt;    &lt;w:cachedcolbalance/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;   &lt;m:mathpr&gt;    &lt;m:mathfont val="Cambria Math"&gt;    &lt;m:brkbin val="before"&gt;    &lt;m:brkbinsub val="&amp;#45;-"&gt;    &lt;m:smallfrac val="off"&gt;    &lt;m:dispdef/&gt;    &lt;m:lmargin val="0"&gt;    &lt;m:rmargin val="0"&gt;    &lt;m:defjc val="centerGroup"&gt;    &lt;m:wrapindent val="1440"&gt;    &lt;m:intlim val="subSup"&gt;    &lt;m:narylim val="undOvr"&gt;   &lt;/m:mathPr&gt;&lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" defunhidewhenused="true" defsemihidden="true" defqformat="false" defpriority="99" latentstylecount="267"&gt;   &lt;w:lsdexception locked="false" priority="0" semihidden="false" unhidewhenused="false" qformat="true" name="Normal"&gt;   &lt;w:lsdexception locked="false" priority="9" semihidden="false" unhidewhenused="false" qformat="true" name="heading 1"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 2"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 3"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 4"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 5"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 6"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 7"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 8"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 9"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 1"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 2"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 3"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 4"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 5"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 6"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 7"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 8"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 9"&gt;   &lt;w:lsdexception locked="false" priority="35" qformat="true" name="caption"&gt;   &lt;w:lsdexception locked="false" priority="10" semihidden="false" unhidewhenused="false" qformat="true" name="Title"&gt;   &lt;w:lsdexception locked="false" priority="1" name="Default Paragraph Font"&gt;   &lt;w:lsdexception locked="false" priority="11" semihidden="false" unhidewhenused="false" qformat="true" name="Subtitle"&gt;   &lt;w:lsdexception locked="false" priority="22" semihidden="false" unhidewhenused="false" qformat="true" name="Strong"&gt;   &lt;w:lsdexception locked="false" priority="20" semihidden="false" unhidewhenused="false" qformat="true" name="Emphasis"&gt;   &lt;w:lsdexception locked="false" priority="59" semihidden="false" unhidewhenused="false" name="Table Grid"&gt;   &lt;w:lsdexception locked="false" unhidewhenused="false" name="Placeholder Text"&gt;   &lt;w:lsdexception locked="false" priority="1" semihidden="false" unhidewhenused="false" qformat="true" name="No Spacing"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 1"&gt;   &lt;w:lsdexception locked="false" unhidewhenused="false" name="Revision"&gt;   &lt;w:lsdexception locked="false" priority="34" semihidden="false" unhidewhenused="false" qformat="true" name="List Paragraph"&gt;   &lt;w:lsdexception locked="false" priority="29" semihidden="false" unhidewhenused="false" qformat="true" name="Quote"&gt;   &lt;w:lsdexception locked="false" priority="30" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Quote"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="19" semihidden="false" unhidewhenused="false" qformat="true" name="Subtle Emphasis"&gt;   &lt;w:lsdexception locked="false" priority="21" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Emphasis"&gt;   &lt;w:lsdexception locked="false" priority="31" semihidden="false" unhidewhenused="false" qformat="true" name="Subtle Reference"&gt;   &lt;w:lsdexception locked="false" priority="32" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Reference"&gt;   &lt;w:lsdexception locked="false" priority="33" semihidden="false" unhidewhenused="false" qformat="true" name="Book Title"&gt;   &lt;w:lsdexception locked="false" priority="37" name="Bibliography"&gt;   &lt;w:lsdexception locked="false" priority="39" qformat="true" name="TOC Heading"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Font Definitions */  @font-face 	{font-family:"Cambria Math"; 	panose-1:2 4 5 3 5 4 6 3 2 4; 	mso-font-charset:1; 	mso-generic-font-family:roman; 	mso-font-format:other; 	mso-font-pitch:variable; 	mso-font-signature:0 0 0 0 0 0;} @font-face 	{font-family:Calibri; 	panose-1:2 15 5 2 2 2 4 3 2 4; 	mso-font-charset:0; 	mso-generic-font-family:swiss; 	mso-font-pitch:variable; 	mso-font-signature:-1610611985 1073750139 0 0 159 0;}  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{mso-style-unhide:no; 	mso-style-qformat:yes; 	mso-style-parent:""; 	margin-top:0in; 	margin-right:0in; 	margin-bottom:10.0pt; 	margin-left:0in; 	line-height:115%; 	mso-pagination:widow-orphan; 	font-size:11.0pt; 	font-family:"Calibri","sans-serif"; 	mso-ascii-font-family:Calibri; 	mso-ascii-theme-font:minor-latin; 	mso-fareast-font-family:Calibri; 	mso-fareast-theme-font:minor-latin; 	mso-hansi-font-family:Calibri; 	mso-hansi-theme-font:minor-latin; 	mso-bidi-font-family:"Times New Roman"; 	mso-bidi-theme-font:minor-bidi;} .MsoChpDefault 	{mso-style-type:export-only; 	mso-default-props:yes; 	mso-ascii-font-family:Calibri; 	mso-ascii-theme-font:minor-latin; 	mso-fareast-font-family:Calibri; 	mso-fareast-theme-font:minor-latin; 	mso-hansi-font-family:Calibri; 	mso-hansi-theme-font:minor-latin; 	mso-bidi-font-family:"Times New Roman"; 	mso-bidi-theme-font:minor-bidi;} .MsoPapDefault 	{mso-style-type:export-only; 	margin-bottom:10.0pt; 	line-height:115%;} @page Section1 	{size:8.5in 11.0in; 	margin:1.0in 1.0in 1.0in 1.0in; 	mso-header-margin:.5in; 	mso-footer-margin:.5in; 	mso-paper-source:0;} div.Section1 	{page:Section1;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"Table Normal"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-priority:99; 	mso-style-qformat:yes; 	mso-style-parent:""; 	mso-padding-alt:0in 5.4pt 0in 5.4pt; 	mso-para-margin-top:0in; 	mso-para-margin-right:0in; 	mso-para-margin-bottom:10.0pt; 	mso-para-margin-left:0in; 	line-height:115%; 	mso-pagination:widow-orphan; 	font-size:11.0pt; 	font-family:"Calibri","sans-serif"; 	mso-ascii-font-family:Calibri; 	mso-ascii-theme-font:minor-latin; 	mso-fareast-font-family:"Times New Roman"; 	mso-fareast-theme-font:minor-fareast; 	mso-hansi-font-family:Calibri; 	mso-hansi-theme-font:minor-latin;} &lt;/style&gt; &lt;![endif]--&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:&amp;quot;;color:blue;"  &gt;&lt;&lt;/span&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:&amp;quot;;color:maroon;"  &gt;asp&lt;/span&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:&amp;quot;;color:blue;"  &gt;:&lt;/span&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:&amp;quot;;color:maroon;"  &gt;Content&lt;/span&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:&amp;quot;;" &gt; &lt;span style="color:red;"&gt;ID&lt;/span&gt;&lt;span style="color:blue;"&gt;="Content1"&lt;/span&gt; &lt;span style="color:red;"&gt;ContentPlaceHolderID&lt;/span&gt;&lt;span style="color:blue;"&gt;="ContentPlaceHolder1"&lt;/span&gt; &lt;span style="color:red;"&gt;Runat&lt;/span&gt;&lt;span style="color:blue;"&gt;="Server"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:&amp;quot;;color:blue;"  &gt;&lt;&lt;/span&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:&amp;quot;;color:maroon;"  &gt;script&lt;/span&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:&amp;quot;;" &gt; &lt;span style="color:red;"&gt;type&lt;/span&gt;&lt;span style="color:blue;"&gt;="text/javascript"&lt;/span&gt; &lt;span style="color:red;"&gt;language&lt;/span&gt;&lt;span style="color:blue;"&gt;="javascript"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:&amp;quot;;color:blue;"  &gt;function&lt;/span&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:&amp;quot;;" &gt; clearingTheLabels()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:&amp;quot;;" &gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:&amp;quot;;" &gt;&lt;span style=""&gt;    &lt;/span&gt;document.body.style.cursor = &lt;span style="color:maroon;"&gt;'wait'&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:&amp;quot;;" &gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;span style="color:blue;"&gt;var&lt;/span&gt; lblGoodbad1=&lt;span style="color:maroon;"&gt;'&lt;%=lbtGoodBadStatus.ClientID %&gt;'&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:&amp;quot;;" &gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;span style="color:blue;"&gt;var&lt;/span&gt; lblwordCount=&lt;span style="color:maroon;"&gt;'&lt;%=lblWordCount.ClientID %&gt;'&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:&amp;quot;;" &gt;&lt;span style=""&gt;     &lt;/span&gt;document.getElementById(lblGoodbad1).style.visibility=&lt;span style="color:maroon;"&gt;"hidden"&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:&amp;quot;;" &gt;&lt;span style=""&gt;     &lt;/span&gt;document.getElementById(lblwordCount).style.visibility=&lt;span style="color:maroon;"&gt;"hidden"&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:&amp;quot;;" &gt;&lt;span style=""&gt;     &lt;/span&gt;document.getElementById(&lt;span style="color:maroon;"&gt;'&lt;%=grdScorer.ClientID %&gt;'&lt;/span&gt;).style.visibility=&lt;span style="color:maroon;"&gt;"hidden"&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:&amp;quot;;" &gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:&amp;quot;;color:blue;"  &gt;&lt;!--&lt;/span--&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:&amp;quot;;color:maroon;"  &gt;script&lt;/span&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:&amp;quot;;color:blue;"  &gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-weight: bold;"&gt;In Code behind&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt; btnUrlToCrawl.Attributes.Add("onclick", "clearingTheLabels();");&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;br /&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:&amp;quot;;color:blue;"  &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:&amp;quot;;color:blue;"  &gt;&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;color:blue;"  &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;span style="color: rgb(0, 0, 0);"&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4926429223536207631-5967892471749550293?l=sudag.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudag.blogspot.com/feeds/5967892471749550293/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4926429223536207631&amp;postID=5967892471749550293' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/5967892471749550293'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/5967892471749550293'/><link rel='alternate' type='text/html' href='http://sudag.blogspot.com/2009/06/javascript-function-to-make-aspnet.html' title='Javascript function to make asp.net control invisible'/><author><name>suda</name><uri>http://www.blogger.com/profile/15635297681991446902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4926429223536207631.post-5909156508940120580</id><published>2009-06-09T04:18:00.000-07:00</published><updated>2009-06-09T04:20:54.740-07:00</updated><title type='text'>Auto-Update as a Simple Custom Control</title><content type='html'>&lt;a href="http://www.vbdotnetheaven.com/UploadFile/scottlysle/CCAutoRefresh11012006154238PM/CCAutoRefresh.aspx"&gt;http://www.vbdotnetheaven.com/UploadFile/scottlysle/CCAutoRefresh11012006154238PM/CCAutoRefresh.aspx&lt;br /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4926429223536207631-5909156508940120580?l=sudag.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudag.blogspot.com/feeds/5909156508940120580/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4926429223536207631&amp;postID=5909156508940120580' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/5909156508940120580'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/5909156508940120580'/><link rel='alternate' type='text/html' href='http://sudag.blogspot.com/2009/06/auto-update-as-simple-custom-control.html' title='Auto-Update as a Simple Custom Control'/><author><name>suda</name><uri>http://www.blogger.com/profile/15635297681991446902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4926429223536207631.post-3233647963839241415</id><published>2009-06-05T06:33:00.000-07:00</published><updated>2009-06-05T06:37:23.271-07:00</updated><title type='text'>Run a .BAT file from ASP.NET</title><content type='html'>&lt;a href="http://codebetter.com/blogs/brendan.tompkins/archive/2004/05/13/13484.aspx"&gt;http://codebetter.com/blogs/brendan.tompkins/archive/2004/05/13/13484.aspx&lt;br /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4926429223536207631-3233647963839241415?l=sudag.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudag.blogspot.com/feeds/3233647963839241415/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4926429223536207631&amp;postID=3233647963839241415' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/3233647963839241415'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/3233647963839241415'/><link rel='alternate' type='text/html' href='http://sudag.blogspot.com/2009/06/run-bat-file-from-aspnet.html' title='Run a .BAT file from ASP.NET'/><author><name>suda</name><uri>http://www.blogger.com/profile/15635297681991446902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4926429223536207631.post-6329527469206920960</id><published>2009-05-28T00:01:00.000-07:00</published><updated>2009-05-28T00:02:16.388-07:00</updated><title type='text'>Export to Excel in ASP.Net 2.0 – Gridview to Excel, DataTable to Excel</title><content type='html'>&lt;a href="http://www.codedigest.com/Articles/ASPNET/130_Export_to_Excel_in_ASPNet_20_%E2%80%93Gridview_to_Excel_DataTable_to_Excel.aspx"&gt;http://www.codedigest.com/Articles/ASPNET/130_Export_to_Excel_in_ASPNet_20_%E2%80%93Gridview_to_Excel_DataTable_to_Excel.aspx&lt;br /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4926429223536207631-6329527469206920960?l=sudag.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudag.blogspot.com/feeds/6329527469206920960/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4926429223536207631&amp;postID=6329527469206920960' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/6329527469206920960'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/6329527469206920960'/><link rel='alternate' type='text/html' href='http://sudag.blogspot.com/2009/05/export-to-excel-in-aspnet-20-gridview.html' title='Export to Excel in ASP.Net 2.0 – Gridview to Excel, DataTable to Excel'/><author><name>suda</name><uri>http://www.blogger.com/profile/15635297681991446902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4926429223536207631.post-1487361120373059845</id><published>2009-05-27T23:55:00.000-07:00</published><updated>2009-05-28T00:01:00.313-07:00</updated><title type='text'>It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level</title><content type='html'>&lt;a href="http://forums.asp.net/t/769696.aspx"&gt;http://forums.asp.net/t/769696.aspx&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4926429223536207631-1487361120373059845?l=sudag.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudag.blogspot.com/feeds/1487361120373059845/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4926429223536207631&amp;postID=1487361120373059845' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/1487361120373059845'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/1487361120373059845'/><link rel='alternate' type='text/html' href='http://sudag.blogspot.com/2009/05/it-is-error-to-use-section-registered.html' title='It is an error to use a section registered as allowDefinition=&apos;MachineToApplication&apos; beyond application level'/><author><name>suda</name><uri>http://www.blogger.com/profile/15635297681991446902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4926429223536207631.post-1836958548450797433</id><published>2009-05-27T05:41:00.001-07:00</published><updated>2009-05-27T05:41:50.554-07:00</updated><title type='text'>ASP.Net 2.0: Export GridView to Excel - Part II</title><content type='html'>&lt;p style="font-weight: bold;"&gt;&lt;span class="ArticleMainHeading"&gt;&lt;span id="ctl00_ContentPlaceHolder1_ArticleHeader1_LabelHeading" style="display: inline-block; width: 100%;"&gt;ASP.Net 2.0: Export GridView to Excel - Part II&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;"&gt;&lt;strong&gt;Introduction:&lt;/strong&gt;&lt;/span&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;" nd="3"&gt;The article "&lt;a href="http://www.c-sharpcorner.com/UploadFile/DipalChoksi/exportxl_asp2_dc11032006003657AM/exportxl_asp2_dc.aspx"&gt;ASP.Net 2.0: Export GridView to Excel&lt;/a&gt;" received &lt;/span&gt;a very good response from our user community. Some of the excellent tips collected from the user feedback have been included in the first version of the article. &lt;/span&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;"&gt;One of the most common questions from our readers is regarding the handling of a Hyperlink column in the GridView Export to Excel. This article will expand on the original article and in this version, we will include the handling the export of the Hyperlink columns in the GridView export to Excel functionality and also re-factor our original logic to use more general features of reflection, allowing for easy extension to include additional control types. This code generalization does have a performance overhead and if the controls embedded in your GridView are limited to a particular set, the original implementation may be more suitable for your requirements.&lt;/span&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;"&gt;&lt;strong&gt;Architectural Changes:&lt;/strong&gt;&lt;/span&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;ol&gt;&lt;span style="font-size:85%;"&gt;&lt;li&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;"&gt;Define a Hash Table which holds the values for the controls to be replaced before the GridView control is exported to Excel.&lt;br /&gt;&lt;br /&gt;This HashTable will map the control types that can be potentially embedded in the GridView to the corresponding control property that will be used to represent the particular control when exported to Excel.&lt;/span&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt; &lt;/li&gt;&lt;li&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;"&gt;The generalized "GetControlPropertyValue" method: In this version, we define a generalized method which will fetch the value of "key" property of the embedded control by using Reflection. We define the key properties for different types of embedded control using our HashTable member variable.&lt;br /&gt;&lt;br /&gt;Our HashTable has been setup to perform the following property mappings.&lt;br /&gt;&lt;br /&gt;&lt;table class="MsoTableGrid" style="border: medium none ; margin: auto auto auto 41.4pt; border-collapse: collapse;" border="1" cellpadding="0" cellspacing="0"&gt; &lt;tbody&gt; &lt;tr style=""&gt; &lt;td style="border: 1pt solid windowtext; padding: 0in 5.4pt; width: 153pt; background-color: transparent;" valign="top" width="204"&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;b style=""&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;Control Type&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;/td&gt; &lt;td style="border-color: windowtext windowtext windowtext rgb(212, 208, 200); border-top: 1pt solid windowtext; border-right: 1pt solid windowtext; border-bottom: 1pt solid windowtext; padding: 0in 5.4pt; width: 3.45in; background-color: transparent;" valign="top" width="331"&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;b style=""&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;Corresponding Value to Represent in Excel&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr style=""&gt; &lt;td style="border-color: rgb(212, 208, 200) windowtext windowtext; border-left: 1pt solid windowtext; border-right: 1pt solid windowtext; border-bottom: 1pt solid windowtext; padding: 0in 5.4pt; width: 153pt; background-color: transparent;" valign="top" width="204"&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;LinkButton or derived class&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt; &lt;td style="border-color: rgb(212, 208, 200) windowtext windowtext rgb(212, 208, 200); border-right: 1pt solid windowtext; border-bottom: 1pt solid windowtext; padding: 0in 5.4pt; width: 3.45in; background-color: transparent;" valign="top" width="331"&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;Text Property value&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr style=""&gt; &lt;td style="border-color: rgb(212, 208, 200) windowtext windowtext; border-left: 1pt solid windowtext; border-right: 1pt solid windowtext; border-bottom: 1pt solid windowtext; padding: 0in 5.4pt; width: 153pt; background-color: transparent;" valign="top" width="204"&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;HyperLink or derived class&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt; &lt;td style="border-color: rgb(212, 208, 200) windowtext windowtext rgb(212, 208, 200); border-right: 1pt solid windowtext; border-bottom: 1pt solid windowtext; padding: 0in 5.4pt; width: 3.45in; background-color: transparent;" valign="top" width="331"&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;Text Property value&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr style=""&gt; &lt;td style="border-color: rgb(212, 208, 200) windowtext windowtext; border-left: 1pt solid windowtext; border-right: 1pt solid windowtext; border-bottom: 1pt solid windowtext; padding: 0in 5.4pt; width: 153pt; background-color: transparent;" valign="top" width="204"&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;DropDownList or derived class&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt; &lt;td style="border-color: rgb(212, 208, 200) windowtext windowtext rgb(212, 208, 200); border-right: 1pt solid windowtext; border-bottom: 1pt solid windowtext; padding: 0in 5.4pt; width: 3.45in; background-color: transparent;" valign="top" width="331"&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;SelectedValue Property Value&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr style=""&gt; &lt;td style="border-color: rgb(212, 208, 200) windowtext windowtext; border-left: 1pt solid windowtext; border-right: 1pt solid windowtext; border-bottom: 1pt solid windowtext; padding: 0in 5.4pt; width: 153pt; background-color: transparent;" valign="top" width="204"&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;CheckBox or derived class&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt; &lt;td style="border-color: rgb(212, 208, 200) windowtext windowtext rgb(212, 208, 200); border-right: 1pt solid windowtext; border-bottom: 1pt solid windowtext; padding: 0in 5.4pt; width: 3.45in; background-color: transparent;" valign="top" width="331"&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;Checked Property Value&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;"&gt;If you need to handle additional control types separately for the export process, these control types can be added to the Hashtable.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt; &lt;/li&gt;&lt;li&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;"&gt;New version of the PrepareGridViewForExport method: In this updated version, we get the "key" property for the control types that we have defined for replacement in our gridview, by calling GetControlPropertyValue if the control type or it's base type is included in the Hashtable for special handling. The control embedded in the GridView is then replaced by the value of the key property. After all the controls embedded in the GridView are processed recursively, the GridView is rendered into an HtmlTextWriter and output to the Excel formatted response.&lt;/span&gt;&lt;/li&gt;&lt;/span&gt;&lt;/ol&gt; &lt;p&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;"&gt;&lt;strong&gt;Complete Code Listing:&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;span style="font-size:85%;"&gt;using&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style="font-size:85%;"&gt; System;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;span style="font-size:85%;"&gt;using&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style="font-size:85%;"&gt; System.Data;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;span style="font-size:85%;"&gt;using&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style="font-size:85%;"&gt; System.Configuration;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;span style="font-size:85%;"&gt;using&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style="font-size:85%;"&gt; System.Collections;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;span style="font-size:85%;"&gt;using&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style="font-size:85%;"&gt; System.Web;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;span style="font-size:85%;"&gt;using&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style="font-size:85%;"&gt; System.Web.Security;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;span style="font-size:85%;"&gt;using&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style="font-size:85%;"&gt; System.Web.UI;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;span style="font-size:85%;"&gt;using&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style="font-size:85%;"&gt; System.Web.UI.WebControls;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;span style="font-size:85%;"&gt;using&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style="font-size:85%;"&gt; System.Web.UI.WebControls.WebParts;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;span style="font-size:85%;"&gt;using&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style="font-size:85%;"&gt; System.Web.UI.HtmlControls;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;span style="font-size:85%;"&gt;using&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style="font-size:85%;"&gt; System.Text;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;span style="font-size:85%;"&gt;using&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style="font-size:85%;"&gt; System.IO;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;span style="font-size:85%;"&gt;using&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style="font-size:85%;"&gt; System.Reflection;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;span style="font-size:85%;"&gt;public&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style="font-size:85%;"&gt; &lt;span style="color: blue;"&gt;partial&lt;/span&gt; &lt;span style="color: blue;"&gt;class&lt;/span&gt; DeleteConfirm : System.Web.UI.Page&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style="font-size:85%;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;&lt;span style="font-size:85%;"&gt;Hashtable&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt; htControls = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: teal;"&gt;Hashtable&lt;/span&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size:85%;"&gt;protected&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; Page_Load(&lt;span style="color: blue;"&gt;object&lt;/span&gt; sender, &lt;span style="color: teal;"&gt;EventArgs&lt;/span&gt; e)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;htControls.Add(&lt;span style="color: maroon;"&gt;"LinkButton"&lt;/span&gt;, &lt;span style="color: maroon;"&gt;"Text"&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;htControls.Add(&lt;span style="color: maroon;"&gt;"HyperLink"&lt;/span&gt;, &lt;span style="color: maroon;"&gt;"Text"&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;htControls.Add(&lt;span style="color: maroon;"&gt;"DropDownList"&lt;/span&gt;, &lt;span style="color: maroon;"&gt;"SelectedItem"&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;htControls.Add(&lt;span style="color: maroon;"&gt;"CheckBox"&lt;/span&gt;, &lt;span style="color: maroon;"&gt;"Checked"&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size:85%;"&gt;protected&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; Button1_Click(&lt;span style="color: blue;"&gt;object&lt;/span&gt; sender, &lt;span style="color: teal;"&gt;EventArgs&lt;/span&gt; e)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;PrepareGridViewForExport(GridView1);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;ExportGridView();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size:85%;"&gt;private&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; ExportGridView()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size:85%;"&gt;string&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt; attachment = &lt;span style="color: maroon;"&gt;"attachment; filename=Contacts.xls"&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;Response.ClearContent();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;Response.AddHeader(&lt;span style="color: maroon;"&gt;"content-disposition"&lt;/span&gt;, attachment);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;Response.ContentType = &lt;span style="color: maroon;"&gt;"application/ms-excel"&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;&lt;span style="font-size:85%;"&gt;StringWriter&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt; sw = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: teal;"&gt;StringWriter&lt;/span&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;HtmlTextWriter htw = &lt;span style="color: blue;"&gt;new&lt;/span&gt; HtmlTextWriter(sw);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;GridView1.RenderControl(htw);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;Response.Write(sw.ToString());&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;      &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;Response.End();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size:85%;"&gt;public&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt; &lt;span style="color: blue;"&gt;override&lt;/span&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; VerifyRenderingInServerForm(Control control)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size:85%;"&gt;private&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; PrepareGridViewForExport(Control gv)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;Literal l = &lt;span style="color: blue;"&gt;new&lt;/span&gt; Literal();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size:85%;"&gt;for&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt; (&lt;span style="color: blue;"&gt;int&lt;/span&gt; i = 0; i &lt;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size:85%;"&gt;if&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt; ((&lt;span style="color: blue;"&gt;null&lt;/span&gt; != htControls[gv.Controls[i].GetType().Name]) || (&lt;span style="color: blue;"&gt;null&lt;/span&gt; != htControls[gv.Controls[i].GetType&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style="font-size:85%;"&gt;               ().BaseType.Name]))&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;                &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;l.Text = GetControlPropertyValue(gv.Controls[i]);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;                &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;gv.Controls.Remove(gv.Controls[i]);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;                &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;gv.Controls.AddAt(i, l);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size:85%;"&gt;if&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt; (gv.Controls[i].HasControls())&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;                &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;PrepareGridViewForExport(gv.Controls[i]);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size:85%;"&gt;private&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt; &lt;span style="color: blue;"&gt;string&lt;/span&gt; GetControlPropertyValue(Control control)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;&lt;span style="font-size:85%;"&gt;Type&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt; controlType = control.GetType();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size:85%;"&gt;string&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt; strControlType = controlType.Name;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size:85%;"&gt;string&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt; strReturn = &lt;span style="color: maroon;"&gt;"Error"&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size:85%;"&gt;bool&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt; bReturn;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;&lt;span style="font-size:85%;"&gt;PropertyInfo&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;[] ctrlProps = controlType.GetProperties();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size:85%;"&gt;string&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt; ExcelPropertyName = (&lt;span style="color: blue;"&gt;string&lt;/span&gt;)htControls[strControlType];&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size:85%;"&gt;if&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt; (ExcelPropertyName == &lt;span style="color: blue;"&gt;null&lt;/span&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;ExcelPropertyName = (&lt;span style="color: blue;"&gt;string&lt;/span&gt;)htControls[control.GetType().BaseType.Name];&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size:85%;"&gt;if&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt; (ExcelPropertyName == &lt;span style="color: blue;"&gt;null&lt;/span&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;                &lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size:85%;"&gt;return&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt; strReturn;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size:85%;"&gt;foreach&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt; (&lt;span style="color: teal;"&gt;PropertyInfo&lt;/span&gt; ctrlProp &lt;span style="color: blue;"&gt;in&lt;/span&gt; ctrlProps)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size:85%;"&gt;if&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt; (ctrlProp.Name == ExcelPropertyName &amp;amp;&amp;amp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;ctrlProp.PropertyType == &lt;span style="color: blue;"&gt;typeof&lt;/span&gt;(&lt;span style="color: teal;"&gt;String&lt;/span&gt;))&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;                &lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size:85%;"&gt;try&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;                &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;                    &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;strReturn = (&lt;span style="color: blue;"&gt;string&lt;/span&gt;)ctrlProp.GetValue(control, &lt;span style="color: blue;"&gt;null&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;                    &lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size:85%;"&gt;break&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;                &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;                &lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size:85%;"&gt;catch&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;                &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;                    &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;strReturn = &lt;span style="color: maroon;"&gt;""&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;                &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;     &lt;/span&gt;&lt;/span&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;       &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size:85%;"&gt;if&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt; (ctrlProp.Name == ExcelPropertyName &amp;amp;&amp;amp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;ctrlProp.PropertyType == &lt;span style="color: blue;"&gt;typeof&lt;/span&gt;(&lt;span style="color: blue;"&gt;bool&lt;/span&gt;))&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;                &lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size:85%;"&gt;try&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;                &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;                    &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;bReturn = (&lt;span style="color: blue;"&gt;bool&lt;/span&gt;)ctrlProp.GetValue(control, &lt;span style="color: blue;"&gt;null&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;                    &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;strReturn = bReturn ? &lt;span style="color: maroon;"&gt;"True"&lt;/span&gt; : &lt;span style="color: maroon;"&gt;"False"&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;                    &lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size:85%;"&gt;break&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;                &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;                &lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size:85%;"&gt;catch&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;                &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;                    &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;strReturn = &lt;span style="color: maroon;"&gt;"Error"&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;                &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size:85%;"&gt;if&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt; (ctrlProp.Name == ExcelPropertyName &amp;amp;&amp;amp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;ctrlProp.PropertyType == &lt;span style="color: blue;"&gt;typeof&lt;/span&gt;(ListItem))&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;                &lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size:85%;"&gt;try&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;                &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;                    &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;strReturn = ((ListItem)(ctrlProp.GetValue(control, &lt;span style="color: blue;"&gt;null&lt;/span&gt;))).Text;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;                    &lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size:85%;"&gt;break&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;                &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;                &lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size:85%;"&gt;catch&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;                &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;                    &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;strReturn = &lt;span style="color: maroon;"&gt;""&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;                &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="font-size:85%;"&gt;return&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt; strReturn;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;&lt;span style="font-size:85%;"&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style="font-size:85%;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;"&gt;&lt;b style=""&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;Conclusion:&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;"&gt;&lt;b style=""&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;"&gt;In this article, we saw the technique for including HyperLink controls embedded in the GridView to be exported to Excel, along with other controls such as DropDownList and CheckBox. We also saw how to use Reflection to setup an extensible function to handle various control types.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:Verdana, Arial, Helvetica, sans-serif;"&gt;Happy Coding!&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4926429223536207631-1836958548450797433?l=sudag.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudag.blogspot.com/feeds/1836958548450797433/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4926429223536207631&amp;postID=1836958548450797433' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/1836958548450797433'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/1836958548450797433'/><link rel='alternate' type='text/html' href='http://sudag.blogspot.com/2009/05/aspnet-20-export-gridview-to-excel-part.html' title='ASP.Net 2.0: Export GridView to Excel - Part II'/><author><name>suda</name><uri>http://www.blogger.com/profile/15635297681991446902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4926429223536207631.post-1356890924448668293</id><published>2009-05-27T05:37:00.000-07:00</published><updated>2009-05-27T05:39:25.625-07:00</updated><title type='text'>ASP.Net 2.0: Export GridView to Excel</title><content type='html'>&lt;span style="font-weight: bold;" class="ArticleMainHeading"&gt;&lt;span id="ctl00_ContentPlaceHolder1_ArticleHeader1_LabelHeading" style="display: inline-block; width: 100%;"&gt;ASP.Net 2.0: Export GridView to Excel&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;strong&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;Introduction:&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;In this article, we will see how to Export an ASP.Net 2.0 GridView to Excel. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;The focus of the article is the Export to Excel functionality - the Gridview and it's data binding are only for demonstrating the Export functionality.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;The code fragments for the Export to Excel functionality below are not linked to the backend structure and can be re-used across projects for the common functionality provided.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;Step 1: Setup your web page with the Gridview&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;In this article, we will assume you are starting with a web page which holds a GridView named GridView1. The GridView in our demo code is bound to a table named "ContactPhone" in a SQL Express database. The following code which exports the databound GridView to Excel is not dependent on the specific databindings and can be used without changes for your scenario.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;ContactPhone Table Structure:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;table class="MsoNormalTable" style="border: medium none ; background: silver none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; width: 315pt; border-collapse: collapse;" bordercolordark="#808080" bordercolorlight="#ffffff" width="420" border="1" cellpadding="0" cellspacing="0"&gt; &lt;tbody&gt; &lt;tr style=""&gt; &lt;td style="border: 1pt inset gray; padding: 0.75pt; background: gray none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;strong&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;Column Name&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt; &lt;td style="border-style: inset inset inset none; border-color: gray gray gray rgb(212, 208, 200); border-width: 1pt 1pt 1pt medium; padding: 0.75pt; background: gray none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;strong&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;Type&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr style=""&gt; &lt;td style="border-style: none inset inset; border-color: rgb(212, 208, 200) gray gray; border-width: medium 1pt 1pt; padding: 0.75pt; background-color: transparent;"&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;ContactID&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt; &lt;td style="border-style: none inset inset none; border-color: rgb(212, 208, 200) gray gray rgb(212, 208, 200); border-width: medium 1pt 1pt medium; padding: 0.75pt; background-color: transparent;"&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;Int (Identity)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr style=""&gt; &lt;td style="border-style: none inset inset; border-color: rgb(212, 208, 200) gray gray; border-width: medium 1pt 1pt; padding: 0.75pt; background-color: transparent;"&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;FName&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt; &lt;td style="border-style: none inset inset none; border-color: rgb(212, 208, 200) gray gray rgb(212, 208, 200); border-width: medium 1pt 1pt medium; padding: 0.75pt; background-color: transparent;"&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;Varchar(50)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr style=""&gt; &lt;td style="border-style: none inset inset; border-color: rgb(212, 208, 200) gray gray; border-width: medium 1pt 1pt; padding: 0.75pt; background-color: transparent;"&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;LName&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt; &lt;td style="border-style: none inset inset none; border-color: rgb(212, 208, 200) gray gray rgb(212, 208, 200); border-width: medium 1pt 1pt medium; padding: 0.75pt; background-color: transparent;"&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;Varchar(50)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr style=""&gt; &lt;td style="border-style: none inset inset; border-color: rgb(212, 208, 200) gray gray; border-width: medium 1pt 1pt; padding: 0.75pt; background-color: transparent;"&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;ContactPhone&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt; &lt;td style="border-style: none inset inset none; border-color: rgb(212, 208, 200) gray gray rgb(212, 208, 200); border-width: medium 1pt 1pt medium; padding: 0.75pt; background-color: transparent;"&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;Varchar(20)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;&lt;strong&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;Step: The Actual Export&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;The code to do the Excel Export is very straightforward. You can also export to different application type by changing the content-disposition and ContentType. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;string&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; attachment = &lt;span style="color: maroon;"&gt;"attachment; filename=Contacts.xls"&lt;/span&gt;;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;Response.ClearContent();&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;Response.AddHeader(&lt;span style="color: maroon;"&gt;"content-disposition"&lt;/span&gt;, attachment);&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;Response.ContentType = &lt;span style="color: maroon;"&gt;"application/ms-excel"&lt;/span&gt;;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: teal; font-family: Verdana;"&gt;StringWriter&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; sw = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: teal;"&gt;StringWriter&lt;/span&gt;();&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: teal; font-family: Verdana;"&gt;HtmlTextWriter&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; htw = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: teal;"&gt;HtmlTextWriter&lt;/span&gt;(sw);&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;GridView1.RenderControl(htw);&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;Response.Write(sw.ToString());&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;Response.End();&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;If you run the code as above, it will result in an HttpException as follows: &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="background: rgb(153, 153, 153) none repeat scroll 0% 0%; font-size: 10pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-family: Verdana;"&gt;Control 'GridView1' of type 'GridView' must be placed inside a form tag with runat=server."&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;To avoid this error, add the following code:  &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;public&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; &lt;span style="color: blue;"&gt;override&lt;/span&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; VerifyRenderingInServerForm(&lt;span style="color: teal;"&gt;Control&lt;/span&gt; control)&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;{&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;u1:p&gt; &lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;}&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;strong&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;Step : Convert the contents&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;If the GridView contains any controls, such as Checkboxes, Dropdownlists, we need to replace the contents with their relevant values. The following recursive function uses Reflection to determine the type of control. The control is deleted in preparation for the Excel export and the relevant value of the control is added.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;private&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; PrepareGridViewForExport(&lt;span style="color: teal;"&gt;Control&lt;/span&gt; gv)&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;{&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;u1:p&gt; &lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: teal; font-family: Verdana;"&gt;&lt;span style=""&gt;    &lt;/span&gt;LinkButton&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; lb = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: teal;"&gt;LinkButton&lt;/span&gt;();&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: teal; font-family: Verdana;"&gt;&lt;span style=""&gt;    &lt;/span&gt;Literal&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; l = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: teal;"&gt;Literal&lt;/span&gt;();&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;span style=""&gt;    &lt;/span&gt;string&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; name = &lt;span style="color: teal;"&gt;String&lt;/span&gt;.Empty;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;span style=""&gt;    &lt;/span&gt;for&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; (&lt;span style="color: blue;"&gt;int&lt;/span&gt; i = 0; i &lt;&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;    &lt;/span&gt;{&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;span style=""&gt;        &lt;/span&gt;if&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; (gv.Controls[i].GetType() == &lt;span style="color: blue;"&gt;typeof&lt;/span&gt;(&lt;span style="color: teal;"&gt;LinkButton&lt;/span&gt;))&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;        &lt;/span&gt;{&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;            &lt;/span&gt;l.Text = (gv.Controls[i] &lt;span style="color: blue;"&gt;as&lt;/span&gt; &lt;span style="color: teal;"&gt;LinkButton&lt;/span&gt;).Text;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;  &lt;/span&gt;gv.Controls.Remove(gv.Controls[i]);&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;  &lt;/span&gt;gv.Controls.AddAt(i, l);&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;        &lt;/span&gt;}&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;span style=""&gt;        &lt;/span&gt;else&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; &lt;span style="color: blue;"&gt;if&lt;/span&gt; (gv.Controls[i].GetType() == &lt;span style="color: blue;"&gt;typeof&lt;/span&gt;(&lt;span style="color: teal;"&gt;DropDownList&lt;/span&gt;))&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;        &lt;/span&gt;{&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;            &lt;/span&gt;l.Text = (gv.Controls[i] &lt;span style="color: blue;"&gt;as&lt;/span&gt; &lt;span style="color: teal;"&gt;DropDownList&lt;/span&gt;).SelectedItem.Text;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;            &lt;/span&gt;gv.Controls.Remove(gv.Controls[i]);&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;            &lt;/span&gt;gv.Controls.AddAt(i, l);&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;        &lt;/span&gt;}&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;span style=""&gt;        &lt;/span&gt;else&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; &lt;span style="color: blue;"&gt;if&lt;/span&gt; (gv.Controls[i].GetType() == &lt;span style="color: blue;"&gt;typeof&lt;/span&gt;(&lt;span style="color: teal;"&gt;CheckBox&lt;/span&gt;))&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;        &lt;/span&gt;{&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;            &lt;/span&gt;l.Text = (gv.Controls[i] &lt;span style="color: blue;"&gt;as&lt;/span&gt; &lt;span style="color: teal;"&gt;CheckBox&lt;/span&gt;).Checked? &lt;span style="color: maroon;"&gt;"True"&lt;/span&gt; : &lt;span style="color: maroon;"&gt;"False"&lt;/span&gt;;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;            &lt;/span&gt;gv.Controls.Remove(gv.Controls[i]);&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;            &lt;/span&gt;gv.Controls.AddAt(i, l);&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;        &lt;/span&gt;}&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;span style=""&gt;        &lt;/span&gt;if&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; (gv.Controls[i].HasControls())&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;        &lt;/span&gt;{&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;            &lt;/span&gt;PrepareGridViewForExport(gv.Controls[i]);&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;        &lt;/span&gt;}&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;}&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p&gt;&lt;strong&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;Code Listing:&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;Image: Page Design&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;v:shapetype id="_x0000_t75" stroked="f" filled="f" path="m@4@5l@4@11@9@11@9@5xe" preferrelative="t" spt="75" coordsize="21600,21600"&gt;&lt;v:stroke joinstyle="miter"&gt;&lt;/v:stroke&gt;&lt;v:formulas&gt;&lt;v:f eqn="if lineDrawn pixelLineWidth 0"&gt;&lt;/v:f&gt;&lt;v:f eqn="sum @0 1 0"&gt;&lt;/v:f&gt;&lt;v:f eqn="sum 0 0 @1"&gt;&lt;/v:f&gt;&lt;v:f eqn="prod @2 1 2"&gt;&lt;/v:f&gt;&lt;v:f eqn="prod @3 21600 pixelWidth"&gt;&lt;/v:f&gt;&lt;v:f eqn="prod @3 21600 pixelHeight"&gt;&lt;/v:f&gt;&lt;v:f eqn="sum @0 0 1"&gt;&lt;/v:f&gt;&lt;v:f eqn="prod @6 1 2"&gt;&lt;/v:f&gt;&lt;v:f eqn="prod @7 21600 pixelWidth"&gt;&lt;/v:f&gt;&lt;v:f eqn="sum @8 21600 0"&gt;&lt;/v:f&gt;&lt;v:f eqn="prod @7 21600 pixelHeight"&gt;&lt;/v:f&gt;&lt;v:f eqn="sum @10 21600 0"&gt;&lt;/v:f&gt;&lt;/v:formulas&gt;&lt;v:path connecttype="rect" gradientshapeok="t" extrusionok="f"&gt;&lt;/v:path&gt;&lt;o:lock aspectratio="t" ext="edit"&gt;&lt;/o:lock&gt;&lt;/v:shapetype&gt;&lt;v:shape id="_x0000_i1025" style="width: 246.75pt; height: 191.25pt;" alt="" type="#_x0000_t75"&gt;&lt;v:imagedata href="http://www.c-sharpcorner.com/UploadFile/DipalChoksi/exportxl_asp2_dc11032006003657AM/Images/ExcelExport1.JPG" src="file:///C:%5CDOCUME%7E1%5Cdchoksi%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_image001.jpg"&gt;&lt;/v:imagedata&gt;&lt;/v:shape&gt;  &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;Image : Sample in action&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;v:shape id="_x0000_i1026" style="width: 342.75pt; height: 204.75pt;" alt="" type="#_x0000_t75"&gt;&lt;v:imagedata href="http://www.c-sharpcorner.com/UploadFile/DipalChoksi/exportxl_asp2_dc11032006003657AM/Images/ExcelExport2.JPG" src="file:///C:%5CDOCUME%7E1%5Cdchoksi%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_image002.jpg"&gt;&lt;/v:imagedata&gt;&lt;/v:shape&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;Image: Export to Excel button is clicked&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;v:shape id="_x0000_i1027" style="width: 303pt; height: 199.5pt;" alt="" type="#_x0000_t75"&gt;&lt;v:imagedata href="http://www.c-sharpcorner.com/UploadFile/DipalChoksi/exportxl_asp2_dc11032006003657AM/Images/ExcelExport3.JPG" src="file:///C:%5CDOCUME%7E1%5Cdchoksi%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_image003.jpg"&gt;&lt;/v:imagedata&gt;&lt;/v:shape&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;Image: GridView contents exported to Excel&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;v:shape id="_x0000_i1028" style="width: 282pt; height: 176.25pt;" alt="" type="#_x0000_t75"&gt;&lt;v:imagedata href="http://www.c-sharpcorner.com/UploadFile/DipalChoksi/exportxl_asp2_dc11032006003657AM/Images/ExcelExport4.JPG" src="file:///C:%5CDOCUME%7E1%5Cdchoksi%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_image004.jpg"&gt;&lt;/v:imagedata&gt;&lt;/v:shape&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;ExcelExport.aspx&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="background: yellow none repeat scroll 0% 0%; font-size: 10pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-family: Verdana;"&gt;&lt;%&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;@&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; &lt;span style="color: maroon;"&gt;Page&lt;/span&gt; &lt;span style="color: red;"&gt;Language&lt;/span&gt;&lt;span style="color: blue;"&gt;="C#"&lt;/span&gt; &lt;span style="color: red;"&gt;AutoEventWireup&lt;/span&gt;&lt;span style="color: blue;"&gt;="true"&lt;/span&gt; &lt;span style="color: red;"&gt;CodeFile&lt;/span&gt;&lt;span style="color: blue;"&gt;="ExportExcel.aspx.cs"&lt;/span&gt; &lt;span style="color: red;"&gt;Inherits&lt;/span&gt;&lt;span style="color: blue;"&gt;="DeleteConfirm"&lt;/span&gt; &lt;span style="background: yellow none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;%&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="background: yellow none repeat scroll 0% 0%; font-size: 10pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-family: Verdana;"&gt;&lt;u1:p&gt; &lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;!&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;DOCTYPE&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; &lt;span style="color: red;"&gt;html&lt;/span&gt; &lt;span style="color: red;"&gt;PUBLIC&lt;/span&gt; &lt;span style="color: blue;"&gt;"-//W3C//DTD XHTML 1.0 Transitional//EN"&lt;/span&gt; &lt;span style="color: blue;"&gt;"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;u1:p&gt; &lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;html&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; &lt;span style="color: red;"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue;"&gt;="http://www.w3.org/1999/xhtml"&lt;/span&gt; &lt;span style="color: blue;"&gt;&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;head&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; &lt;span style="color: red;"&gt;runat&lt;/span&gt;&lt;span style="color: blue;"&gt;="server"&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;title&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;Contacts Listing&lt;span style="color: blue;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: maroon;"&gt;title&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;/&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;head&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;body&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;form&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; &lt;span style="color: red;"&gt;id&lt;/span&gt;&lt;span style="color: blue;"&gt;="form1"&lt;/span&gt; &lt;span style="color: red;"&gt;runat&lt;/span&gt;&lt;span style="color: blue;"&gt;="server"&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;div&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;strong&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&gt;&lt;&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;span&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; &lt;span style="color: red;"&gt;style&lt;/span&gt;&lt;span style="color: blue;"&gt;="font-size: small; font-family: Arial; text-decoration: underline"&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;Contacts Listing &lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;asp&lt;/span&gt;&lt;span style="color: blue;"&gt;:&lt;/span&gt;&lt;span style="color: maroon;"&gt;Button&lt;/span&gt; &lt;span style="color: red;"&gt;ID&lt;/span&gt;&lt;span style="color: blue;"&gt;="Button1"&lt;/span&gt; &lt;span style="color: red;"&gt;runat&lt;/span&gt;&lt;span style="color: blue;"&gt;="server"&lt;/span&gt; &lt;span style="color: red;"&gt;OnClick&lt;/span&gt;&lt;span style="color: blue;"&gt;="Button1_Click"&lt;/span&gt; &lt;span style="color: red;"&gt;Text&lt;/span&gt;&lt;span style="color: blue;"&gt;="Export To Excel"&lt;/span&gt; &lt;span style="color: blue;"&gt;/&gt;&lt;/&lt;/span&gt;&lt;span style="color: maroon;"&gt;span&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;/&lt;/span&gt;&lt;span style="color: maroon;"&gt;strong&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;br&lt;/span&gt; &lt;span style="color: blue;"&gt;/&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;br&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; &lt;span style="color: blue;"&gt;/&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;asp&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;:&lt;/span&gt;&lt;span style="background: lime none repeat scroll 0% 0%; font-size: 10pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: maroon; font-family: Verdana;"&gt;GridView&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; &lt;span style="color: red;"&gt;ID&lt;/span&gt;&lt;span style="color: blue;"&gt;="GridView1"&lt;/span&gt; &lt;span style="color: red;"&gt;runat&lt;/span&gt;&lt;span style="color: blue;"&gt;="server"&lt;/span&gt; &lt;span style="color: red;"&gt;AutoGenerateColumns&lt;/span&gt;&lt;span style="color: blue;"&gt;="False"&lt;/span&gt; &lt;span style="color: red;"&gt;DataKeyNames&lt;/span&gt;&lt;span style="color: blue;"&gt;="ContactID"&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: red; font-family: Verdana;"&gt;DataSourceID&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;="SqlDataSource1"&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; &lt;span style="color: red;"&gt;EmptyDataText&lt;/span&gt;&lt;span style="color: blue;"&gt;="There are no data records to display."&lt;/span&gt; &lt;span style="color: red;"&gt;style&lt;/span&gt;&lt;span style="color: blue;"&gt;="font-size: small; font-family: Arial"&lt;/span&gt; &lt;span style="color: red;"&gt;BackColor&lt;/span&gt;&lt;span style="color: blue;"&gt;="White"&lt;/span&gt; &lt;span style="color: red;"&gt;BorderColor&lt;/span&gt;&lt;span style="color: blue;"&gt;="#DEDFDE"&lt;/span&gt; &lt;span style="color: red;"&gt;BorderStyle&lt;/span&gt;&lt;span style="color: blue;"&gt;="None"&lt;/span&gt; &lt;span style="color: red;"&gt;BorderWidth&lt;/span&gt;&lt;span style="color: blue;"&gt;="1px"&lt;/span&gt; &lt;span style="color: red;"&gt;CellPadding&lt;/span&gt;&lt;span style="color: blue;"&gt;="4"&lt;/span&gt; &lt;span style="color: red;"&gt;ForeColor&lt;/span&gt;&lt;span style="color: blue;"&gt;="Black"&lt;/span&gt; &lt;span style="color: red;"&gt;GridLines&lt;/span&gt;&lt;span style="color: blue;"&gt;="Vertical"&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;Columns&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;asp&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;:&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;BoundField&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; &lt;span style="color: red;"&gt;DataField&lt;/span&gt;&lt;span style="color: blue;"&gt;="ContactID"&lt;/span&gt; &lt;span style="color: red;"&gt;HeaderText&lt;/span&gt;&lt;span style="color: blue;"&gt;="ContactID"&lt;/span&gt; &lt;span style="color: red;"&gt;ReadOnly&lt;/span&gt;&lt;span style="color: blue;"&gt;="True"&lt;/span&gt; &lt;span style="color: red;"&gt;SortExpression&lt;/span&gt;&lt;span style="color: blue;"&gt;="ContactID"&lt;/span&gt; &lt;span style="color: red;"&gt;Visible&lt;/span&gt;&lt;span style="color: blue;"&gt;="False"&lt;/span&gt; &lt;span style="color: blue;"&gt;/&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;asp&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;:&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;BoundField&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; &lt;span style="color: red;"&gt;DataField&lt;/span&gt;&lt;span style="color: blue;"&gt;="FName"&lt;/span&gt; &lt;span style="color: red;"&gt;HeaderText&lt;/span&gt;&lt;span style="color: blue;"&gt;="First Name"&lt;/span&gt; &lt;span style="color: red;"&gt;SortExpression&lt;/span&gt;&lt;span style="color: blue;"&gt;="FName"&lt;/span&gt; &lt;span style="color: blue;"&gt;/&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;asp&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;:&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;BoundField&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; &lt;span style="color: red;"&gt;DataField&lt;/span&gt;&lt;span style="color: blue;"&gt;="LName"&lt;/span&gt; &lt;span style="color: red;"&gt;HeaderText&lt;/span&gt;&lt;span style="color: blue;"&gt;="Last Name"&lt;/span&gt; &lt;span style="color: red;"&gt;SortExpression&lt;/span&gt;&lt;span style="color: blue;"&gt;="LName"&lt;/span&gt; &lt;span style="color: blue;"&gt;/&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;asp&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;:&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;BoundField&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; &lt;span style="color: red;"&gt;DataField&lt;/span&gt;&lt;span style="color: blue;"&gt;="ContactPhone"&lt;/span&gt; &lt;span style="color: red;"&gt;HeaderText&lt;/span&gt;&lt;span style="color: blue;"&gt;="Phone"&lt;/span&gt; &lt;span style="color: red;"&gt;SortExpression&lt;/span&gt;&lt;span style="color: blue;"&gt;="ContactPhone"&lt;/span&gt; &lt;span style="color: blue;"&gt;/&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;asp&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;:&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;TemplateField&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; &lt;span style="color: red;"&gt;HeaderText&lt;/span&gt;&lt;span style="color: blue;"&gt;="Favorites"&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;ItemTemplate&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;span style="color: red;"&gt; &lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;asp&lt;/span&gt;&lt;span style="color: blue;"&gt;:&lt;/span&gt;&lt;span style="color: maroon;"&gt;CheckBox&lt;/span&gt; &lt;span style="color: red;"&gt;ID&lt;/span&gt;&lt;span style="color: blue;"&gt;="CheckBox1"&lt;/span&gt; &lt;span style="color: red;"&gt;runat&lt;/span&gt;&lt;span style="color: blue;"&gt;="server"&lt;/span&gt; &lt;span style="color: blue;"&gt;/&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;/&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;ItemTemplate&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&gt;&lt;/&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;asp&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;:&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;TemplateField&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;/&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;Columns&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;FooterStyle&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; &lt;span style="color: red;"&gt;BackColor&lt;/span&gt;&lt;span style="color: blue;"&gt;="#CCCC99"&lt;/span&gt; &lt;span style="color: blue;"&gt;/&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;RowStyle&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; &lt;span style="color: red;"&gt;BackColor&lt;/span&gt;&lt;span style="color: blue;"&gt;="#F7F7DE"&lt;/span&gt; &lt;span style="color: blue;"&gt;/&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;SelectedRowStyle&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; &lt;span style="color: red;"&gt;BackColor&lt;/span&gt;&lt;span style="color: blue;"&gt;="#CE5D5A"&lt;/span&gt; &lt;span style="color: red;"&gt;Font-Bold&lt;/span&gt;&lt;span style="color: blue;"&gt;="True"&lt;/span&gt; &lt;span style="color: red;"&gt;ForeColor&lt;/span&gt;&lt;span style="color: blue;"&gt;="White"&lt;/span&gt; &lt;span style="color: blue;"&gt;/&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;PagerStyle&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; &lt;span style="color: red;"&gt;BackColor&lt;/span&gt;&lt;span style="color: blue;"&gt;="#F7F7DE"&lt;/span&gt; &lt;span style="color: red;"&gt;ForeColor&lt;/span&gt;&lt;span style="color: blue;"&gt;="Black"&lt;/span&gt; &lt;span style="color: red;"&gt;HorizontalAlign&lt;/span&gt;&lt;span style="color: blue;"&gt;="Right"&lt;/span&gt; &lt;span style="color: blue;"&gt;/&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;HeaderStyle&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; &lt;span style="color: red;"&gt;BackColor&lt;/span&gt;&lt;span style="color: blue;"&gt;="#6B696B"&lt;/span&gt; &lt;span style="color: red;"&gt;Font-Bold&lt;/span&gt;&lt;span style="color: blue;"&gt;="True"&lt;/span&gt; &lt;span style="color: red;"&gt;ForeColor&lt;/span&gt;&lt;span style="color: blue;"&gt;="White"&lt;/span&gt; &lt;span style="color: blue;"&gt;/&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;AlternatingRowStyle&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; &lt;span style="color: red;"&gt;BackColor&lt;/span&gt;&lt;span style="color: blue;"&gt;="White"&lt;/span&gt; &lt;span style="color: blue;"&gt;/&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;/&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;asp&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;:&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;GridView&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;u1:p&gt; &lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;asp&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;:&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;SqlDataSource&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; &lt;span style="color: red;"&gt;ID&lt;/span&gt;&lt;span style="color: blue;"&gt;="SqlDataSource1"&lt;/span&gt; &lt;span style="color: red;"&gt;runat&lt;/span&gt;&lt;span style="color: blue;"&gt;="server"&lt;/span&gt; &lt;span style="color: red;"&gt;ConnectionString&lt;/span&gt;&lt;span style="color: blue;"&gt;="&lt;/span&gt;&lt;span style="background: yellow none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;%&lt;/span&gt;$ ConnectionStrings:ContactsConnectionString1 &lt;span style="background: yellow none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;%&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;"&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: red; font-family: Verdana;"&gt;DeleteCommand&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;="DELETE FROM [ContactPhone] WHERE [ContactID] = @ContactID"&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; &lt;span style="color: red;"&gt;InsertCommand&lt;/span&gt;&lt;span style="color: blue;"&gt;="INSERT INTO [ContactPhone] ([FName], [LName], [ContactPhone]) VALUES (@FName, @LName, @ContactPhone)"&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: red; font-family: Verdana;"&gt;ProviderName&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;="&lt;/span&gt;&lt;span style="background: yellow none repeat scroll 0% 0%; font-size: 10pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-family: Verdana;"&gt;&lt;%&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;$ ConnectionStrings:ContactsConnectionString1.ProviderName &lt;span style="background: yellow none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;%&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;"&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: red; font-family: Verdana;"&gt;SelectCommand&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;="SELECT [ContactID], [FName], [LName], [ContactPhone] FROM [ContactPhone]"&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: red; font-family: Verdana;"&gt;UpdateCommand&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;="UPDATE [ContactPhone] SET [FName] = @FName, [LName] = @LName, [ContactPhone] = @ContactPhone WHERE [ContactID] = @ContactID"&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;InsertParameters&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;asp&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;:&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;Parameter&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; &lt;span style="color: red;"&gt;Name&lt;/span&gt;&lt;span style="color: blue;"&gt;="FName"&lt;/span&gt; &lt;span style="color: red;"&gt;Type&lt;/span&gt;&lt;span style="color: blue;"&gt;="String"&lt;/span&gt; &lt;span style="color: blue;"&gt;/&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;asp&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;:&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;Parameter&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; &lt;span style="color: red;"&gt;Name&lt;/span&gt;&lt;span style="color: blue;"&gt;="LName"&lt;/span&gt; &lt;span style="color: red;"&gt;Type&lt;/span&gt;&lt;span style="color: blue;"&gt;="String"&lt;/span&gt; &lt;span style="color: blue;"&gt;/&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;asp&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;:&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;Parameter&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; &lt;span style="color: red;"&gt;Name&lt;/span&gt;&lt;span style="color: blue;"&gt;="ContactPhone"&lt;/span&gt; &lt;span style="color: red;"&gt;Type&lt;/span&gt;&lt;span style="color: blue;"&gt;="String"&lt;/span&gt; &lt;span style="color: blue;"&gt;/&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;/&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;InsertParameters&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;UpdateParameters&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;asp&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;:&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;Parameter&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; &lt;span style="color: red;"&gt;Name&lt;/span&gt;&lt;span style="color: blue;"&gt;="FName"&lt;/span&gt; &lt;span style="color: red;"&gt;Type&lt;/span&gt;&lt;span style="color: blue;"&gt;="String"&lt;/span&gt; &lt;span style="color: blue;"&gt;/&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;asp&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;:&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;Parameter&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; &lt;span style="color: red;"&gt;Name&lt;/span&gt;&lt;span style="color: blue;"&gt;="LName"&lt;/span&gt; &lt;span style="color: red;"&gt;Type&lt;/span&gt;&lt;span style="color: blue;"&gt;="String"&lt;/span&gt; &lt;span style="color: blue;"&gt;/&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;asp&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;:&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;Parameter&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; &lt;span style="color: red;"&gt;Name&lt;/span&gt;&lt;span style="color: blue;"&gt;="ContactPhone"&lt;/span&gt; &lt;span style="color: red;"&gt;Type&lt;/span&gt;&lt;span style="color: blue;"&gt;="String"&lt;/span&gt; &lt;span style="color: blue;"&gt;/&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;asp&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;:&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;Parameter&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; &lt;span style="color: red;"&gt;Name&lt;/span&gt;&lt;span style="color: blue;"&gt;="ContactID"&lt;/span&gt; &lt;span style="color: red;"&gt;Type&lt;/span&gt;&lt;span style="color: blue;"&gt;="Int32"&lt;/span&gt; &lt;span style="color: blue;"&gt;/&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;/&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;UpdateParameters&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;DeleteParameters&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;asp&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;:&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;Parameter&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; &lt;span style="color: red;"&gt;Name&lt;/span&gt;&lt;span style="color: blue;"&gt;="ContactID"&lt;/span&gt; &lt;span style="color: red;"&gt;Type&lt;/span&gt;&lt;span style="color: blue;"&gt;="Int32"&lt;/span&gt; &lt;span style="color: blue;"&gt;/&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;/&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;DeleteParameters&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;/&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;asp&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;:&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;SqlDataSource&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: red; font-family: Verdana;"&gt; &lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;br&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; &lt;span style="color: blue;"&gt;/&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;/&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;div&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;/&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;form&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;/&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;body&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&lt;/&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: Verdana;"&gt;html&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;ExcelExport.aspx.cs &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;using&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; System;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;using&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; System.Data;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;using&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; System.Configuration;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;using&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; System.Collections;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;using&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; System.Web;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;using&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; System.Web.Security;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;using&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; System.Web.UI;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;using&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; System.Web.UI.WebControls;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;using&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; System.Web.UI.WebControls.WebParts;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;using&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; System.Web.UI.HtmlControls;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;using&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; System.Text;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;using&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; System.IO;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;u1:p&gt; &lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;public&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; &lt;span style="color: blue;"&gt;partial&lt;/span&gt; &lt;span style="color: blue;"&gt;class&lt;/span&gt; DeleteConfirm : System.Web.UI.Page&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;{&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;u1:p&gt; &lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;span style="color: blue;"&gt;protected&lt;/span&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; Page_Load(&lt;span style="color: blue;"&gt;object&lt;/span&gt; sender, &lt;span style="color: teal;"&gt;EventArgs&lt;/span&gt; e)&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;    &lt;/span&gt;{&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;    &lt;/span&gt;}&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;u1:p&gt; &lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;span style="color: blue;"&gt;protected&lt;/span&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; Button1_Click(&lt;span style="color: blue;"&gt;object&lt;/span&gt; sender, &lt;span style="color: teal;"&gt;EventArgs&lt;/span&gt; e)&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;    &lt;/span&gt;{&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;span style="color: green;"&gt;//Export the GridView to Excel&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;        &lt;/span&gt;PrepareGridViewForExport(GridView1);&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;        &lt;/span&gt;ExportGridView();&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;    &lt;/span&gt;}&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;u1:p&gt; &lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;span style="color: blue;"&gt;private&lt;/span&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; ExportGridView()&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;    &lt;/span&gt;{&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;string&lt;/span&gt; attachment = &lt;span style="color: maroon;"&gt;"attachment; filename=Contacts.xls"&lt;/span&gt;;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;        &lt;/span&gt;Response.ClearContent();&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;        &lt;/span&gt;Response.AddHeader(&lt;span style="color: maroon;"&gt;"content-disposition"&lt;/span&gt;, attachment);&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;        &lt;/span&gt;Response.ContentType = &lt;span style="color: maroon;"&gt;"application/ms-excel"&lt;/span&gt;;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;span style="color: teal;"&gt;StringWriter&lt;/span&gt; sw = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: teal;"&gt;StringWriter&lt;/span&gt;();&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;        &lt;/span&gt;HtmlTextWriter htw = &lt;span style="color: blue;"&gt;new&lt;/span&gt; HtmlTextWriter(sw);&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;        &lt;/span&gt;GridView1.RenderControl(htw);&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;        &lt;/span&gt;Response.Write(sw.ToString());&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;        &lt;/span&gt;Response.End();&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;    &lt;/span&gt;}&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;u1:p&gt; &lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;override&lt;/span&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; VerifyRenderingInServerForm(Control control)&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;    &lt;/span&gt;{&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;    &lt;/span&gt;}&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;u1:p&gt; &lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;span style="color: blue;"&gt;private&lt;/span&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; PrepareGridViewForExport(Control gv)&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;    &lt;/span&gt;{&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;        &lt;/span&gt;LinkButton lb = &lt;span style="color: blue;"&gt;new&lt;/span&gt; LinkButton();&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;        &lt;/span&gt;Literal l = &lt;span style="color: blue;"&gt;new&lt;/span&gt; Literal();&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;string&lt;/span&gt; name = &lt;span style="color: teal;"&gt;String&lt;/span&gt;.Empty;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;for&lt;/span&gt; (&lt;span style="color: blue;"&gt;int&lt;/span&gt; i = 0; i &lt;&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;        &lt;/span&gt;{&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;            &lt;/span&gt;&lt;span style="color: blue;"&gt;if&lt;/span&gt; (gv.Controls[i].GetType() == &lt;span style="color: blue;"&gt;typeof&lt;/span&gt;(LinkButton))&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;            &lt;/span&gt;{&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;                &lt;/span&gt;l.Text = (gv.Controls[i] &lt;span style="color: blue;"&gt;as&lt;/span&gt; LinkButton).Text;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;                &lt;/span&gt;gv.Controls.Remove(gv.Controls[i]);&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;                &lt;/span&gt;gv.Controls.AddAt(i, l);&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;            &lt;/span&gt;}&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;            &lt;/span&gt;&lt;span style="color: blue;"&gt;else&lt;/span&gt; &lt;span style="color: blue;"&gt;if&lt;/span&gt; (gv.Controls[i].GetType() == &lt;span style="color: blue;"&gt;typeof&lt;/span&gt;(DropDownList))&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;            &lt;/span&gt;{&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;                &lt;/span&gt;l.Text = (gv.Controls[i] &lt;span style="color: blue;"&gt;as&lt;/span&gt; DropDownList).SelectedItem.Text;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;                &lt;/span&gt;gv.Controls.Remove(gv.Controls[i]);&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;      &lt;/span&gt;&lt;span style=""&gt;          &lt;/span&gt;gv.Controls.AddAt(i, l);&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;            &lt;/span&gt;}&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;            &lt;/span&gt;&lt;span style="color: blue;"&gt;else&lt;/span&gt; &lt;span style="color: blue;"&gt;if&lt;/span&gt; (gv.Controls[i].GetType() == &lt;span style="color: blue;"&gt;typeof&lt;/span&gt;(CheckBox))&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;            &lt;/span&gt;{&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;                &lt;/span&gt;l.Text = (gv.Controls[i] &lt;span style="color: blue;"&gt;as&lt;/span&gt; CheckBox).Checked ? &lt;span style="color: maroon;"&gt;"True"&lt;/span&gt; : &lt;span style="color: maroon;"&gt;"False"&lt;/span&gt;;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;                &lt;/span&gt;gv.Controls.Remove(gv.Controls[i]);&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;                &lt;/span&gt;gv.Controls.AddAt(i, l);&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;            &lt;/span&gt;}&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;            &lt;/span&gt;&lt;span style="color: blue;"&gt;if&lt;/span&gt; (gv.Controls[i].HasControls())&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;            &lt;/span&gt;{&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;                &lt;/span&gt;PrepareGridViewForExport(gv.Controls[i]);&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;            &lt;/span&gt;}&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;        &lt;/span&gt;}&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;    &lt;/span&gt;}&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;}&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;strong&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;Implementation Options: &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;In quite a few cases, developers face an error in the Export functionality - typically the error message is "RegisterForEventValidation can only be called during Render();". &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;Our website readers have contributed some good suggestions in the article comments below. I would particularly like to highlight the suggestion by Marianna, who provides an alternative implementation to the VerifyRenderingInServerForm override. This approach is described below: &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;Step 1: Implement the Export functionality as described above.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;Step 2: Remove the code to override the VerifyRenderingInServerForm method.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;Step 3: Modify the code for the ExportGridView function as below. The code highlighted in green creates and HtmlForm on the fly, before exporting the gridview, adds the gridview to this new form and renders the form (instead of rendering the gridview in our original implementation) &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;"&gt;private&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; ExportGridView()&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;{&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;          &lt;/span&gt;&lt;span style="color: blue;"&gt;string&lt;/span&gt; attachment = "attachment; filename=Contacts.xls";&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;          &lt;/span&gt;Response.ClearContent();&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;          &lt;/span&gt;Response.AddHeader("content-disposition", attachment);&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;          &lt;/span&gt;Response.ContentType = "application/ms-excel";&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;          &lt;/span&gt;StringWriter sw = &lt;span style="color: blue;"&gt;new&lt;/span&gt; StringWriter();&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;          &lt;/span&gt;HtmlTextWriter htw = &lt;span style="color: blue;"&gt;new&lt;/span&gt; HtmlTextWriter(sw);&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;u1:p&gt; &lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;          &lt;/span&gt;&lt;span style="color: green;"&gt;// Create a form to contain the grid&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;          &lt;/span&gt;HtmlForm frm = &lt;span style="color: blue;"&gt;new&lt;/span&gt; HtmlForm();&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;          &lt;/span&gt;GridView1.Parent.Controls.Add(frm);&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;          &lt;/span&gt;frm.Attributes["runat"] = "server";&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;          &lt;/span&gt;frm.Controls.Add(GridView1);&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;u1:p&gt; &lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;          &lt;/span&gt;frm.RenderControl(htw);&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;          &lt;/span&gt;&lt;span style="color: green;"&gt;//GridView1.RenderControl(htw);&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;          &lt;/span&gt;Response.Write(sw.ToString());&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span style=""&gt;          &lt;/span&gt;Response.End();&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;}&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;This implementation has the advantage that it can be setup as re-usable code in a separate library, without having to override the base class method each time. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;strong&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;Note to readers:&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;Thank you for your comments and feedback! Happy coding!!!&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;/span&gt; &lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;strong&gt;&lt;u&gt;&lt;a href="http://www.c-sharpcorner.com/UploadFile/DipalChoksi/exportxl_asp22_dc04022007235740PM/exportxl_asp22_dc.aspx?ArticleID=1195fe8c-c6f5-4d52-925b-953f4b9de344"&gt;ASP.Net 2.0: Export GridView to Excel - Part II &lt;/a&gt;&lt;/u&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;This &lt;a href="http://www.c-sharpcorner.com/UploadFile/DipalChoksi/exportxl_asp22_dc04022007235740PM/exportxl_asp22_dc.aspx?ArticleID=1195fe8c-c6f5-4d52-925b-953f4b9de344"&gt;version of the article&lt;/a&gt; includes handling of the Hyperlink columns in the GridView export to Excel and also re-factors our original logic to use more general features of Reflection &lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt; &lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;strong&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;Conclusion:&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;In this article, we saw how to Export an ASP.Net 2.0 GridView to Excel. The code fragments are not linked to the backend structure and can be re-used across projects for the common functionality provided.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;The focus of the article is the Export to Excel functionality - the Gridview and it's data binding are only for demonstrating the following functionality. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;For reference on Exporting ASP.Net 1.1 DataGrid to Excel: &lt;a href="http://www.c-sharpcorner.com/Code/2003/Sept/ExportASPNetDataGridToExcel.asp"&gt;Export ASP.NET DataGrid to Excel&lt;/a&gt;  &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;span style="font-size: 10pt; font-family: Verdana;" lang="EN"&gt;Disclaimer:&lt;span style="color: rgb(153, 204, 204);"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 10pt; color: rgb(51, 51, 51); font-family: Verdana;"&gt;This article is for purely educational purposes and is a compilation of notes, material and my understanding on this subject. Any resemblance to other material is an un-intentional coincidence and should not be misconstrued as malicious, slanderous, or any anything else hereof.&lt;/span&gt;&lt;span style="font-size: 10pt; color: rgb(153, 204, 204); font-family: Verdana;" lang="EN"&gt; &lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4926429223536207631-1356890924448668293?l=sudag.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudag.blogspot.com/feeds/1356890924448668293/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4926429223536207631&amp;postID=1356890924448668293' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/1356890924448668293'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/1356890924448668293'/><link rel='alternate' type='text/html' href='http://sudag.blogspot.com/2009/05/aspnet-20-export-gridview-to-excel.html' title='ASP.Net 2.0: Export GridView to Excel'/><author><name>suda</name><uri>http://www.blogger.com/profile/15635297681991446902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4926429223536207631.post-6678642981170425925</id><published>2009-05-26T04:02:00.000-07:00</published><updated>2009-05-26T04:05:40.968-07:00</updated><title type='text'>Java script for button control in code behind in asp.net</title><content type='html'>protected void Page_Load(object sender, EventArgs e)&lt;br /&gt;    {&lt;br /&gt;        btnFirst.Attributes.Add("onmouseover", "this.className='handCursor';");&lt;br /&gt;        btnFirst.Attributes.Add("onmouseout", "this.className='defaultCursor';");&lt;br /&gt;        btnPrev.Attributes.Add("onmouseover", "this.className='handCursor';");&lt;br /&gt;        btnPrev.Attributes.Add("onmouseout", "this.className='defaultCursor';");&lt;br /&gt;        btnNext.Attributes.Add("onmouseover", "this.className='handCursor';");&lt;br /&gt;        btnNext.Attributes.Add("onmouseout", "this.className='defaultCursor';");&lt;br /&gt;        btnLast.Attributes.Add("onmouseover", "this.className='handCursor';");&lt;br /&gt;        btnLast.Attributes.Add("onmouseout", "this.className='defaultCursor';");&lt;br /&gt;&lt;br /&gt;        if (!Page.IsPostBack)&lt;br /&gt;        {&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;CSS functions&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; .handCursor&lt;br /&gt;        {&lt;br /&gt;            cursor:hand;&lt;br /&gt;            color:Orange;&lt;br /&gt;            background-color:Transparent;&lt;br /&gt;            border-left-color: transparent;&lt;br /&gt;            border-bottom-color: transparent;&lt;br /&gt;            border-top-style: none;&lt;br /&gt;            border-top-color: transparent;&lt;br /&gt;            border-right-style: none;&lt;br /&gt;            border-left-style: none;&lt;br /&gt;            border-bottom-style:none;&lt;br /&gt;            border-right-color: transparent;&lt;br /&gt;            font:Arial;&lt;br /&gt;            font-size:11pt;&lt;br /&gt;            font-weight:bold;&lt;br /&gt;           &lt;br /&gt;        }&lt;br /&gt;        .defaultCursor&lt;br /&gt;        {&lt;br /&gt;            cursor:default;&lt;br /&gt;            background-color:Transparent;&lt;br /&gt;            border-left-color: transparent;&lt;br /&gt;            border-bottom-color: transparent;&lt;br /&gt;            border-top-style: none;&lt;br /&gt;            border-top-color: transparent;&lt;br /&gt;            border-right-style: none;&lt;br /&gt;            border-left-style: none;&lt;br /&gt;            border-bottom-style:none;&lt;br /&gt;            border-right-color: transparent;&lt;br /&gt;            color:Teal;&lt;br /&gt;            font:Arial;&lt;br /&gt;            font-size:12pt;&lt;br /&gt;            font-weight:bold;&lt;br /&gt;        }&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4926429223536207631-6678642981170425925?l=sudag.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudag.blogspot.com/feeds/6678642981170425925/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4926429223536207631&amp;postID=6678642981170425925' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/6678642981170425925'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/6678642981170425925'/><link rel='alternate' type='text/html' href='http://sudag.blogspot.com/2009/05/java-script-for-button-control-in-code.html' title='Java script for button control in code behind in asp.net'/><author><name>suda</name><uri>http://www.blogger.com/profile/15635297681991446902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4926429223536207631.post-1663036094056903652</id><published>2009-05-25T00:25:00.000-07:00</published><updated>2009-05-25T00:27:56.116-07:00</updated><title type='text'>GridView Sorting</title><content type='html'>protected void gridViolationDetails_Sorting(object sender, GridViewSortEventArgs e)&lt;br /&gt;    {&lt;br /&gt;        DataTable dtsort = (DataTable)ViewState["viewStatViolation"];&lt;br /&gt;&lt;br /&gt;        string sortExpression = e.SortExpression;&lt;br /&gt;        if (GridViewSortDirection == SortDirection.Ascending)&lt;br /&gt;        {&lt;br /&gt;            GridViewSortDirection = SortDirection.Descending;&lt;br /&gt;            SortGridView(sortExpression, "DESC", gridViolationDetails, dtsort);&lt;br /&gt;        }&lt;br /&gt;        else&lt;br /&gt;        {&lt;br /&gt;            GridViewSortDirection = SortDirection.Ascending;&lt;br /&gt;            SortGridView(sortExpression, "ASC", gridViolationDetails, dtsort);&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public SortDirection GridViewSortDirection&lt;br /&gt;    {&lt;br /&gt;        get&lt;br /&gt;        {&lt;br /&gt;            if (ViewState["sortDirection"] == null)&lt;br /&gt;                ViewState["sortDirection"] = SortDirection.Ascending;&lt;br /&gt;            return (SortDirection)ViewState["sortDirection"];&lt;br /&gt;        }&lt;br /&gt;        set&lt;br /&gt;        {&lt;br /&gt;            ViewState["sortDirection"] = value;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    private void SortGridView(string sortExpression, string direction,GridView grdV,DataTable dt)&lt;br /&gt;    {&lt;br /&gt;        DataView dv = new DataView(dt);&lt;br /&gt;        dv.Sort = sortExpression + " " + direction;&lt;br /&gt;        grdV.DataSource = dv;&lt;br /&gt;        grdV.DataBind();&lt;br /&gt;    }&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4926429223536207631-1663036094056903652?l=sudag.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudag.blogspot.com/feeds/1663036094056903652/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4926429223536207631&amp;postID=1663036094056903652' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/1663036094056903652'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/1663036094056903652'/><link rel='alternate' type='text/html' href='http://sudag.blogspot.com/2009/05/gridview-sorting.html' title='GridView Sorting'/><author><name>suda</name><uri>http://www.blogger.com/profile/15635297681991446902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4926429223536207631.post-3986606734472358673</id><published>2009-04-22T06:42:00.000-07:00</published><updated>2009-04-22T06:49:30.799-07:00</updated><title type='text'>Practical threaded programming with Python</title><content type='html'>&lt;a href="http://www.ibm.com/developerworks/aix/library/au-threadingpython/index.html"&gt;http://www.ibm.com/developerworks/aix/library/au-threadingpython/index.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4926429223536207631-3986606734472358673?l=sudag.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudag.blogspot.com/feeds/3986606734472358673/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4926429223536207631&amp;postID=3986606734472358673' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/3986606734472358673'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/3986606734472358673'/><link rel='alternate' type='text/html' href='http://sudag.blogspot.com/2009/04/practical-threaded-programming-with.html' title='Practical threaded programming with Python'/><author><name>suda</name><uri>http://www.blogger.com/profile/15635297681991446902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4926429223536207631.post-2503750907906218331</id><published>2009-04-06T08:37:00.000-07:00</published><updated>2009-04-06T09:07:39.246-07:00</updated><title type='text'>Creating Setup and Deployment Projects in VS.NET &amp;&amp; Set a password textbox for Visual Studio .NET setup project</title><content type='html'>&lt;a href="http://www.c-sharpcorner.com/UploadFile/vishnuprasad2005/SetupProjects12022005022406AM/SetupProjects.aspx"&gt;http://www.c-sharpcorner.com/UploadFile/vishnuprasad2005/SetupProjects12022005022406AM/SetupProjects.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.codeproject.com/KB/install/setupprjpwd.aspx?fid=33512&amp;amp;df=90&amp;amp;mpp=25&amp;amp;noise=3&amp;amp;sort=Position&amp;amp;view=Quick&amp;amp;select=746338"&gt;http://www.codeproject.com/KB/install/setupprjpwd.aspx?fid=33512&amp;amp;df=90&amp;amp;mpp=25&amp;amp;noise=3&amp;amp;sort=Position&amp;amp;view=Quick&amp;amp;select=746338&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4926429223536207631-2503750907906218331?l=sudag.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudag.blogspot.com/feeds/2503750907906218331/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4926429223536207631&amp;postID=2503750907906218331' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/2503750907906218331'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/2503750907906218331'/><link rel='alternate' type='text/html' href='http://sudag.blogspot.com/2009/04/creating-setup-and-deployment-projects.html' title='Creating Setup and Deployment Projects in VS.NET &amp;&amp; Set a password textbox for Visual Studio .NET setup project'/><author><name>suda</name><uri>http://www.blogger.com/profile/15635297681991446902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4926429223536207631.post-2204813136481983583</id><published>2009-03-20T02:45:00.000-07:00</published><updated>2009-03-20T02:46:14.977-07:00</updated><title type='text'>50 Ways to Kill Excel using .net</title><content type='html'>&lt;a href="http://www.devcity.net/PrintArticle.aspx?ArticleID=239"&gt;http://www.devcity.net/PrintArticle.aspx?ArticleID=239&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4926429223536207631-2204813136481983583?l=sudag.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudag.blogspot.com/feeds/2204813136481983583/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4926429223536207631&amp;postID=2204813136481983583' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/2204813136481983583'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/2204813136481983583'/><link rel='alternate' type='text/html' href='http://sudag.blogspot.com/2009/03/50-ways-to-kill-excel-using-net.html' title='50 Ways to Kill Excel using .net'/><author><name>suda</name><uri>http://www.blogger.com/profile/15635297681991446902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4926429223536207631.post-9176232211827940511</id><published>2009-02-20T04:23:00.000-08:00</published><updated>2009-02-20T04:25:22.179-08:00</updated><title type='text'>Disabling Close Button on Forms using .net 2.0</title><content type='html'>&lt;h2 style="color: rgb(153, 102, 51);"&gt;Using the Code&lt;/h2&gt;  &lt;p style="color: rgb(153, 102, 51);"&gt;During construction and creation of the &lt;code&gt;Form &lt;/code&gt;object, .NET would use the default creation parameters available in the base class &lt;code&gt;CreateParams &lt;/code&gt;property. In fact, &lt;code&gt;CreateParams &lt;/code&gt;property is available in &lt;code&gt;Forms.Control &lt;/code&gt;class. In our form class (derived from &lt;code&gt;System.Windows.Forms.Form&lt;/code&gt;), override this property and modify the creation flags. For disabling the Close button use 0x200 to modify the &lt;code&gt;ClassStyle &lt;/code&gt;member of the &lt;code&gt;CreateParams&lt;/code&gt;. &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;private const int CP_NOCLOSE_BUTTON = 0x200;&lt;br /&gt;        protected override CreateParams CreateParams&lt;br /&gt;        {&lt;br /&gt;            get&lt;br /&gt;            {&lt;br /&gt;                CreateParams myCp = base.CreateParams;&lt;br /&gt;                myCp.ClassStyle = myCp.ClassStyle | CP_NOCLOSE_BUTTON;&lt;br /&gt;                return myCp;&lt;br /&gt;            }&lt;br /&gt;        }&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4926429223536207631-9176232211827940511?l=sudag.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudag.blogspot.com/feeds/9176232211827940511/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4926429223536207631&amp;postID=9176232211827940511' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/9176232211827940511'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/9176232211827940511'/><link rel='alternate' type='text/html' href='http://sudag.blogspot.com/2009/02/disabling-close-button-on-forms-using.html' title='Disabling Close Button on Forms using .net 2.0'/><author><name>suda</name><uri>http://www.blogger.com/profile/15635297681991446902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4926429223536207631.post-4822033561984905745</id><published>2009-02-13T02:17:00.000-08:00</published><updated>2009-02-13T02:19:24.844-08:00</updated><title type='text'>How to implement a simple filewatcher Windows service in C#</title><content type='html'>&lt;a href="http://www.codeproject.com/KB/files/C__FileWatcher.aspx?display=PrintAll&amp;amp;fid=410731&amp;amp;df=90&amp;amp;mpp=25&amp;amp;noise=3&amp;amp;sort=Position&amp;amp;view=Quick&amp;amp;select=2014241"&gt;http://www.codeproject.com/KB/files/C__FileWatcher.aspx?display=PrintAll&amp;amp;fid=410731&amp;amp;df=90&amp;amp;mpp=25&amp;amp;noise=3&amp;amp;sort=Position&amp;amp;view=Quick&amp;amp;select=2014241&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4926429223536207631-4822033561984905745?l=sudag.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudag.blogspot.com/feeds/4822033561984905745/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4926429223536207631&amp;postID=4822033561984905745' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/4822033561984905745'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/4822033561984905745'/><link rel='alternate' type='text/html' href='http://sudag.blogspot.com/2009/02/how-to-implement-simple-filewatcher.html' title='How to implement a simple filewatcher Windows service in C#'/><author><name>suda</name><uri>http://www.blogger.com/profile/15635297681991446902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4926429223536207631.post-3688246508442602197</id><published>2009-02-10T04:13:00.000-08:00</published><updated>2009-02-10T04:14:26.991-08:00</updated><title type='text'>How can I run some Python script within C# program?</title><content type='html'>&lt;a href="http://groups.google.com/group/comp.lang.python/browse_frm/thread/da2a675da29b0bd/197b6a89095ef930?lnk=st&amp;amp;q&amp;amp;rnum=4&amp;amp;pli=1"&gt;http://groups.google.com/group/comp.lang.python/browse_frm/thread/da2a675da29b0bd/197b6a89095ef930?lnk=st&amp;amp;q&amp;amp;rnum=4&amp;amp;pli=1&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4926429223536207631-3688246508442602197?l=sudag.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudag.blogspot.com/feeds/3688246508442602197/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4926429223536207631&amp;postID=3688246508442602197' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/3688246508442602197'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/3688246508442602197'/><link rel='alternate' type='text/html' href='http://sudag.blogspot.com/2009/02/how-can-i-run-some-python-script-within.html' title='How can I run some Python script within C# program?'/><author><name>suda</name><uri>http://www.blogger.com/profile/15635297681991446902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4926429223536207631.post-1378577756902936087</id><published>2009-01-21T06:12:00.000-08:00</published><updated>2009-01-21T06:13:21.483-08:00</updated><title type='text'>Cross-thread operation not valid: Control accessed from a thread other than the thread it was created on.</title><content type='html'>&lt;a href="http://stackoverflow.com/questions/142003/cross-thread-operation-not-valid-control-accessed-from-a-thread-other-than-the"&gt;http://stackoverflow.com/questions/142003/cross-thread-operation-not-valid-control-accessed-from-a-thread-other-than-the&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4926429223536207631-1378577756902936087?l=sudag.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudag.blogspot.com/feeds/1378577756902936087/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4926429223536207631&amp;postID=1378577756902936087' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/1378577756902936087'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/1378577756902936087'/><link rel='alternate' type='text/html' href='http://sudag.blogspot.com/2009/01/cross-thread-operation-not-valid.html' title='Cross-thread operation not valid: Control accessed from a thread other than the thread it was created on.'/><author><name>suda</name><uri>http://www.blogger.com/profile/15635297681991446902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4926429223536207631.post-192757123001699632</id><published>2009-01-21T06:11:00.000-08:00</published><updated>2009-01-21T06:12:20.526-08:00</updated><title type='text'>Multithreading in .NET With the BackgroundWorker</title><content type='html'>&lt;a href="http://amgadhs.com/index.php/2008/11/multithreading-in-net-with-the-backgroundworker/"&gt;http://amgadhs.com/index.php/2008/11/multithreading-in-net-with-the-backgroundworker/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4926429223536207631-192757123001699632?l=sudag.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudag.blogspot.com/feeds/192757123001699632/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4926429223536207631&amp;postID=192757123001699632' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/192757123001699632'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/192757123001699632'/><link rel='alternate' type='text/html' href='http://sudag.blogspot.com/2009/01/multithreading-in-net-with.html' title='Multithreading in .NET With the BackgroundWorker'/><author><name>suda</name><uri>http://www.blogger.com/profile/15635297681991446902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4926429223536207631.post-7692328487712844509</id><published>2008-12-30T04:35:00.000-08:00</published><updated>2008-12-30T04:37:01.499-08:00</updated><title type='text'>Convert Image to Icon in .Net</title><content type='html'>&lt;div&gt;&lt;ol&gt;&lt;li&gt;&lt;div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"&gt;    &lt;span style="color: rgb(0, 128, 128); font-style: italic;"&gt;/// &lt;summary&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"&gt;    &lt;span style="color: rgb(0, 128, 128); font-style: italic;"&gt;/// Converts an image into an icon.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"&gt;    &lt;span style="color: rgb(0, 128, 128); font-style: italic;"&gt;/// &lt;/summary&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"&gt;    &lt;span style="color: rgb(0, 128, 128); font-style: italic;"&gt;/// &lt;param name="img"&gt;The image that shall become an icon&lt;/param&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"&gt;    &lt;span style="color: rgb(0, 128, 128); font-style: italic;"&gt;/// &lt;param name="size"&gt;The width and height of the icon. Standard&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"&gt;    &lt;span style="color: rgb(0, 128, 128); font-style: italic;"&gt;/// sizes are 16x16, 32x32, 48x48, 64x64.&lt;/param&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"&gt;    &lt;span style="color: rgb(0, 128, 128); font-style: italic;"&gt;/// &lt;param name="keepAspectRatio"&gt;Whether the image should be squashed into a&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"&gt;    &lt;span style="color: rgb(0, 128, 128); font-style: italic;"&gt;/// square or whether whitespace should be put around it.&lt;/param&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"&gt;    &lt;span style="color: rgb(0, 128, 128); font-style: italic;"&gt;/// &lt;returns&gt;An icon!!&lt;/returns&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"&gt;    &lt;span style="color: rgb(6, 0, 255);"&gt;private&lt;/span&gt; Icon MakeIcon&lt;span style="color: rgb(0, 0, 0);"&gt;(&lt;/span&gt;Image img, &lt;span style="color: rgb(255, 0, 0);"&gt;int&lt;/span&gt; size, &lt;span style="color: rgb(255, 0, 0);"&gt;bool&lt;/span&gt; keepAspectRatio&lt;span style="color: rgb(0, 0, 0);"&gt;)&lt;/span&gt; &lt;span style="color: rgb(0, 0, 0);"&gt;{&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"&gt;      Bitmap square = &lt;a href="http://www.google.com/search?q=new+msdn.microsoft.com"&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;new&lt;/span&gt;&lt;/a&gt; Bitmap&lt;span style="color: rgb(0, 0, 0);"&gt;(&lt;/span&gt;size, size&lt;span style="color: rgb(0, 0, 0);"&gt;)&lt;/span&gt;; &lt;span style="color: rgb(0, 128, 128); font-style: italic;"&gt;// create new bitmap&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"&gt;      Graphics g = Graphics.&lt;span style="color: rgb(0, 0, 255);"&gt;FromImage&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;(&lt;/span&gt;square&lt;span style="color: rgb(0, 0, 0);"&gt;)&lt;/span&gt;; &lt;span style="color: rgb(0, 128, 128); font-style: italic;"&gt;// allow drawing to it&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"&gt; &lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"&gt;      &lt;span style="color: rgb(255, 0, 0);"&gt;int&lt;/span&gt; x, y, w, h; &lt;span style="color: rgb(0, 128, 128); font-style: italic;"&gt;// dimensions for new image&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"&gt; &lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"&gt;      &lt;span style="color: rgb(6, 0, 255);"&gt;if&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;(&lt;/span&gt;!keepAspectRatio || img.&lt;span style="color: rgb(0, 0, 255);"&gt;Height&lt;/span&gt; == img.&lt;span style="color: rgb(0, 0, 255);"&gt;Width&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;)&lt;/span&gt; &lt;span style="color: rgb(0, 0, 0);"&gt;{&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"&gt;        &lt;span style="color: rgb(0, 128, 128); font-style: italic;"&gt;// just fill the square&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"&gt;        x = y = &lt;span style="color: rgb(255, 0, 0);"&gt;0&lt;/span&gt;; &lt;span style="color: rgb(0, 128, 128); font-style: italic;"&gt;// set x and y to 0&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"&gt;        w = h = size; &lt;span style="color: rgb(0, 128, 128); font-style: italic;"&gt;// set width and height to size&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"&gt;      &lt;span style="color: rgb(0, 0, 0);"&gt;}&lt;/span&gt; &lt;span style="color: rgb(6, 0, 255);"&gt;else&lt;/span&gt; &lt;span style="color: rgb(0, 0, 0);"&gt;{&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"&gt;        &lt;span style="color: rgb(0, 128, 128); font-style: italic;"&gt;// work out the aspect ratio&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"&gt;        &lt;span style="color: rgb(255, 0, 0);"&gt;float&lt;/span&gt; r = &lt;span style="color: rgb(0, 0, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;float&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;)&lt;/span&gt;img.&lt;span style="color: rgb(0, 0, 255);"&gt;Width&lt;/span&gt; / &lt;span style="color: rgb(0, 0, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;float&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;)&lt;/span&gt;img.&lt;span style="color: rgb(0, 0, 255);"&gt;Height&lt;/span&gt;;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"&gt; &lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"&gt;        &lt;span style="color: rgb(0, 128, 128); font-style: italic;"&gt;// set dimensions accordingly to fit inside size^2 square&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"&gt;        &lt;span style="color: rgb(6, 0, 255);"&gt;if&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;(&lt;/span&gt;r &gt; &lt;span style="color: rgb(255, 0, 0);"&gt;1&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;)&lt;/span&gt; &lt;span style="color: rgb(0, 0, 0);"&gt;{&lt;/span&gt; &lt;span style="color: rgb(0, 128, 128); font-style: italic;"&gt;// w is bigger, so divide h by r&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"&gt;          w = size;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"&gt;          h = &lt;span style="color: rgb(0, 0, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;int&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;)&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;float&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;)&lt;/span&gt;size / r&lt;span style="color: rgb(0, 0, 0);"&gt;)&lt;/span&gt;;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"&gt;          x = &lt;span style="color: rgb(255, 0, 0);"&gt;0&lt;/span&gt;; y = &lt;span style="color: rgb(0, 0, 0);"&gt;(&lt;/span&gt;size - h&lt;span style="color: rgb(0, 0, 0);"&gt;)&lt;/span&gt; / &lt;span style="color: rgb(255, 0, 0);"&gt;2&lt;/span&gt;; &lt;span style="color: rgb(0, 128, 128); font-style: italic;"&gt;// center the image&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"&gt;        &lt;span style="color: rgb(0, 0, 0);"&gt;}&lt;/span&gt; &lt;span style="color: rgb(6, 0, 255);"&gt;else&lt;/span&gt; &lt;span style="color: rgb(0, 0, 0);"&gt;{&lt;/span&gt; &lt;span style="color: rgb(0, 128, 128); font-style: italic;"&gt;// h is bigger, so multiply w by r&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"&gt;          w = &lt;span style="color: rgb(0, 0, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;int&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;)&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;float&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;)&lt;/span&gt;size * r&lt;span style="color: rgb(0, 0, 0);"&gt;)&lt;/span&gt;;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"&gt;          h = size;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"&gt;          y = &lt;span style="color: rgb(255, 0, 0);"&gt;0&lt;/span&gt;; x = &lt;span style="color: rgb(0, 0, 0);"&gt;(&lt;/span&gt;size - w&lt;span style="color: rgb(0, 0, 0);"&gt;)&lt;/span&gt; / &lt;span style="color: rgb(255, 0, 0);"&gt;2&lt;/span&gt;; &lt;span style="color: rgb(0, 128, 128); font-style: italic;"&gt;// center the image&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"&gt;        &lt;span style="color: rgb(0, 0, 0);"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"&gt;      &lt;span style="color: rgb(0, 0, 0);"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"&gt; &lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"&gt;      &lt;span style="color: rgb(0, 128, 128); font-style: italic;"&gt;// make the image shrink nicely by using HighQualityBicubic mode&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"&gt;      g.&lt;span style="color: rgb(0, 0, 255);"&gt;InterpolationMode&lt;/span&gt; = &lt;span style="color: rgb(0, 0, 0);"&gt;System&lt;/span&gt;.&lt;span style="color: rgb(0, 0, 255);"&gt;Drawing&lt;/span&gt;.&lt;span style="color: rgb(0, 0, 255);"&gt;Drawing2D&lt;/span&gt;.&lt;span style="color: rgb(0, 0, 255);"&gt;InterpolationMode&lt;/span&gt;.&lt;span style="color: rgb(0, 0, 255);"&gt;HighQualityBicubic&lt;/span&gt;;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"&gt;      g.&lt;span style="color: rgb(0, 0, 255);"&gt;DrawImage&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;(&lt;/span&gt;img, x, y, w, h&lt;span style="color: rgb(0, 0, 0);"&gt;)&lt;/span&gt;; &lt;span style="color: rgb(0, 128, 128); font-style: italic;"&gt;// draw image with specified dimensions&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"&gt;      g.&lt;span style="color: rgb(0, 0, 255);"&gt;Flush&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;)&lt;/span&gt;; &lt;span style="color: rgb(0, 128, 128); font-style: italic;"&gt;// make sure all drawing operations complete before we get the icon&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"&gt; &lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"&gt;      &lt;span style="color: rgb(0, 128, 128); font-style: italic;"&gt;// following line would work directly on any image, but then&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"&gt;      &lt;span style="color: rgb(0, 128, 128); font-style: italic;"&gt;// it wouldn't look as nice.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"&gt;      &lt;span style="color: rgb(6, 0, 255);"&gt;return&lt;/span&gt; Icon.&lt;span style="color: rgb(0, 0, 255);"&gt;FromHandle&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;(&lt;/span&gt;square.&lt;span style="color: rgb(0, 0, 255);"&gt;GetHicon&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;)&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;)&lt;/span&gt;;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="font-family: 'Courier New',Courier,monospace; font-weight: normal;"&gt;    &lt;span style="color: rgb(0, 0, 0);"&gt;}&lt;/span&gt; &lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4926429223536207631-7692328487712844509?l=sudag.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudag.blogspot.com/feeds/7692328487712844509/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4926429223536207631&amp;postID=7692328487712844509' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/7692328487712844509'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/7692328487712844509'/><link rel='alternate' type='text/html' href='http://sudag.blogspot.com/2008/12/convert-image-to-icon-in-net_30.html' title='Convert Image to Icon in .Net'/><author><name>suda</name><uri>http://www.blogger.com/profile/15635297681991446902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4926429223536207631.post-4960571440257718691</id><published>2008-12-28T23:14:00.000-08:00</published><updated>2008-12-28T23:17:21.444-08:00</updated><title type='text'>Creating CSV file using Oledb object in C#.net</title><content type='html'>OleDbConnection OleDbCon = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + strCSVPath + ";Extended Properties=\"text;HDR=Yes;FMT=Delimited(,)\"");&lt;br /&gt;OleDbCmd = new OleDbCommand("Create table BundlesTable.csv(ProjectName varchar(250),BundleName varchar(250),BundleItems varchar(250))", OleDbCon);&lt;br /&gt;                    OleDbCmd.ExecuteNonQuery();&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4926429223536207631-4960571440257718691?l=sudag.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudag.blogspot.com/feeds/4960571440257718691/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4926429223536207631&amp;postID=4960571440257718691' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/4960571440257718691'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/4960571440257718691'/><link rel='alternate' type='text/html' href='http://sudag.blogspot.com/2008/12/creating-csv-file-using-oledb-object-in.html' title='Creating CSV file using Oledb object in C#.net'/><author><name>suda</name><uri>http://www.blogger.com/profile/15635297681991446902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4926429223536207631.post-4444781258099462498</id><published>2008-12-08T03:19:00.000-08:00</published><updated>2008-12-08T03:22:35.166-08:00</updated><title type='text'>Visual Studio Windows Application Setup Project</title><content type='html'>&lt;a href="Visual%20Studio%20Windows%20Application%20Setup%20Project"&gt;http://www.codeproject.com/KB/dotnet/Win_App_Setup_Project.aspx&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4926429223536207631-4444781258099462498?l=sudag.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudag.blogspot.com/feeds/4444781258099462498/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4926429223536207631&amp;postID=4444781258099462498' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/4444781258099462498'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/4444781258099462498'/><link rel='alternate' type='text/html' href='http://sudag.blogspot.com/2008/12/visual-studio-windows-application-setup.html' title='Visual Studio Windows Application Setup Project'/><author><name>suda</name><uri>http://www.blogger.com/profile/15635297681991446902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4926429223536207631.post-5970616569042925569</id><published>2008-12-05T01:15:00.000-08:00</published><updated>2008-12-05T01:16:16.204-08:00</updated><title type='text'>Converting numbers into formatted strings in VB.NET</title><content type='html'>&lt;a style="color: rgb(204, 0, 0);" href="http://articles.techrepublic.com.com/5100-10878_11-6103431.html"&gt;http://articles.techrepublic.com.com/5100-10878_11-6103431.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4926429223536207631-5970616569042925569?l=sudag.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudag.blogspot.com/feeds/5970616569042925569/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4926429223536207631&amp;postID=5970616569042925569' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/5970616569042925569'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/5970616569042925569'/><link rel='alternate' type='text/html' href='http://sudag.blogspot.com/2008/12/converting-numbers-into-formatted.html' title='Converting numbers into formatted strings in VB.NET'/><author><name>suda</name><uri>http://www.blogger.com/profile/15635297681991446902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4926429223536207631.post-715253541574157177</id><published>2008-11-21T01:02:00.000-08:00</published><updated>2008-11-21T01:03:23.940-08:00</updated><title type='text'>Opening the link or website in .net windows application</title><content type='html'>&lt;span style="color: rgb(153, 51, 0);"&gt; System.Diagnostics.Process.Start("http://decidyn.com");&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4926429223536207631-715253541574157177?l=sudag.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudag.blogspot.com/feeds/715253541574157177/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4926429223536207631&amp;postID=715253541574157177' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/715253541574157177'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/715253541574157177'/><link rel='alternate' type='text/html' href='http://sudag.blogspot.com/2008/11/opening-link-or-website-in-net-windows.html' title='Opening the link or website in .net windows application'/><author><name>suda</name><uri>http://www.blogger.com/profile/15635297681991446902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4926429223536207631.post-136213290809359407</id><published>2008-11-04T06:02:00.000-08:00</published><updated>2008-11-04T06:03:36.417-08:00</updated><title type='text'>Converting String to Datetime in C#.net 2.0</title><content type='html'>System.Globalization.CultureInfo culture = new System.Globalization.CultureInfo("en-US", false);&lt;br /&gt;           culture.DateTimeFormat.DateSeparator = string.Empty;&lt;br /&gt;           culture.DateTimeFormat.ShortDatePattern = "yyyyMMdd";&lt;br /&gt;&lt;br /&gt;dateime dt=DateTime.ParseExact(startEndDate[1].ToString(),"yyyyMMdd", culture)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4926429223536207631-136213290809359407?l=sudag.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudag.blogspot.com/feeds/136213290809359407/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4926429223536207631&amp;postID=136213290809359407' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/136213290809359407'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/136213290809359407'/><link rel='alternate' type='text/html' href='http://sudag.blogspot.com/2008/11/converting-string-to-datetime-in-cnet.html' title='Converting String to Datetime in C#.net 2.0'/><author><name>suda</name><uri>http://www.blogger.com/profile/15635297681991446902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4926429223536207631.post-8453787473544978222</id><published>2008-10-31T23:37:00.000-07:00</published><updated>2008-10-31T23:46:14.405-07:00</updated><title type='text'>Exporting a DataGridView to an Excel/PDF/image file by using Reporting Services report generation</title><content type='html'>&lt;a href="http://www.codeproject.com/KB/reporting-services/ReportExporters_WinForms.aspx"&gt;www.codeproject.com/KB/reporting-services/ReportExporters_WinForms.aspx&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4926429223536207631-8453787473544978222?l=sudag.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudag.blogspot.com/feeds/8453787473544978222/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4926429223536207631&amp;postID=8453787473544978222' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/8453787473544978222'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/8453787473544978222'/><link rel='alternate' type='text/html' href='http://sudag.blogspot.com/2008/10/exporting-datagridview-to-excelpdfimage.html' title='Exporting a DataGridView to an Excel/PDF/image file by using Reporting Services report generation'/><author><name>suda</name><uri>http://www.blogger.com/profile/15635297681991446902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4926429223536207631.post-6310000245595479811</id><published>2008-10-16T05:24:00.000-07:00</published><updated>2008-10-16T05:27:04.381-07:00</updated><title type='text'>Getting Unique field of a column form a table( also get distinct count of  column of datatable)</title><content type='html'>&lt;span style="color: rgb(255, 102, 102);"&gt;public DataTable SelectDistinct(string TableName, DataTable SourceTable, string FieldName)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;       {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;           DataTable dt = new DataTable(TableName);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;           dt.Columns.Add(FieldName, SourceTable.Columns[FieldName].DataType);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;           object LastValue = null;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;           foreach (DataRow dr in SourceTable.Select("", FieldName))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;           {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;               if (LastValue == null || !(ColumnEqual(LastValue, dr[FieldName])))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;               {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;                   LastValue = dr[FieldName];&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;                   dt.Rows.Add(new object[] { LastValue });&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;               }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;           }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;           //if (ds != null)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;           //    ds.Tables.Add(dt);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;           return dt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;       }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;       private bool ColumnEqual(object A, object B)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;       {&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;           // Compares two values to see if they are equal. Also compares DBNULL.Value.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;           // Note: If your DataTable contains object fields, then you must extend this&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;           // function to handle them in a meaningful way if you intend to group on them.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;           if (A == DBNull.Value &amp;amp;&amp;amp; B == DBNull.Value) //  both are DBNull.Value&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;               return true;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;           if (A == DBNull.Value || B == DBNull.Value) //  only one is DBNull.Value&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;               return false;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;           return (A.Equals(B));  // value type standard comparison&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;       }&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4926429223536207631-6310000245595479811?l=sudag.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudag.blogspot.com/feeds/6310000245595479811/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4926429223536207631&amp;postID=6310000245595479811' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/6310000245595479811'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/6310000245595479811'/><link rel='alternate' type='text/html' href='http://sudag.blogspot.com/2008/10/getting-unique-field-of-column-form.html' title='Getting Unique field of a column form a table( also get distinct count of  column of datatable)'/><author><name>suda</name><uri>http://www.blogger.com/profile/15635297681991446902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4926429223536207631.post-2014377605635313854</id><published>2008-09-14T22:49:00.000-07:00</published><updated>2008-09-14T22:50:51.665-07:00</updated><title type='text'>Using Generic lists with crystal reports in .net</title><content type='html'>&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;Public&lt;/span&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt; &lt;span style="color: blue;"&gt;Sub&lt;/span&gt; ReportDocumentListDetails(&lt;span style="color: blue;"&gt;ByVal&lt;/span&gt; rptPath &lt;span style="color: blue;"&gt;As&lt;/span&gt; &lt;span style="color: blue;"&gt;String&lt;/span&gt;, &lt;span style="color: blue;"&gt;ByVal&lt;/span&gt; reportname &lt;span style="color: blue;"&gt;As&lt;/span&gt; &lt;span style="color: blue;"&gt;String&lt;/span&gt;, &lt;span style="color: blue;"&gt;ByVal&lt;/span&gt; rptdoc &lt;span style="color: blue;"&gt;As&lt;/span&gt; CrystalDecisions.CrystalReports.Engine.ReportDocument, _&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;                                   &lt;/span&gt;&lt;span style="color: blue;"&gt;ByVal&lt;/span&gt; arListName &lt;span style="color: blue;"&gt;As&lt;/span&gt; System.Collections.ArrayList, &lt;span style="color: blue;"&gt;ByVal&lt;/span&gt; arListValue &lt;span style="color: blue;"&gt;As&lt;/span&gt; System.Collections.ArrayList)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt; &lt;/span&gt;&lt;span style=""&gt;       &lt;/span&gt;&lt;span style="color: blue;"&gt;Dim&lt;/span&gt; rptViewer &lt;span style="color: blue;"&gt;As&lt;/span&gt; &lt;span style="color: blue;"&gt;New&lt;/span&gt; CrystalDecisions.Windows.Forms.CrystalReportViewer()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;Dim&lt;/span&gt; ds &lt;span style="color: blue;"&gt;As&lt;/span&gt; DatasetReport = &lt;span style="color: blue;"&gt;New&lt;/span&gt; DatasetReport&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;     &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;If&lt;/span&gt; (arListName.Count = arListValue.Count) &lt;span style="color: blue;"&gt;Then&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;            &lt;/span&gt;&lt;span style="color: blue;"&gt;For&lt;/span&gt; i &lt;span style="color: blue;"&gt;As&lt;/span&gt; &lt;span style="color: blue;"&gt;Integer&lt;/span&gt; = 0 &lt;span style="color: blue;"&gt;To&lt;/span&gt; arListName.Count - 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;                &lt;/span&gt;rptdoc.SetParameterValue(arListName(i).ToString, arListValue(i))&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;            &lt;/span&gt;&lt;span style="color: blue;"&gt;Next&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;End&lt;/span&gt; &lt;span style="color: blue;"&gt;If&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;Dim&lt;/span&gt; objExOpt &lt;span style="color: blue;"&gt;As&lt;/span&gt; CrystalDecisions.Shared.ExportOptions&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;Dim&lt;/span&gt; objDiskOpt &lt;span style="color: blue;"&gt;As&lt;/span&gt; &lt;span style="color: blue;"&gt;New&lt;/span&gt; CrystalDecisions.Shared.DiskFileDestinationOptions&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;        &lt;/span&gt;objDiskOpt.DiskFileName = &lt;span style="color: maroon;"&gt;"F:\nath\"&lt;/span&gt; &amp;amp; reportname &amp;amp; &lt;span style="color: maroon;"&gt;".pdf"&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;        &lt;/span&gt;objExOpt = rptdoc.ExportOptions&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;        &lt;/span&gt;objExOpt.ExportDestinationType = CrystalDecisions.Shared.ExportDestinationType.DiskFile&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;        &lt;/span&gt;objExOpt.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.PortableDocFormat&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;        &lt;/span&gt;objExOpt.DestinationOptions = objDiskOpt&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;        &lt;/span&gt;rptdoc.Export(objExOpt)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;        &lt;/span&gt;rptdoc.Close()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; line-height: 115%; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;span style="color: blue;"&gt;End&lt;/span&gt; &lt;span style="color: blue;"&gt;Sub&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4926429223536207631-2014377605635313854?l=sudag.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudag.blogspot.com/feeds/2014377605635313854/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4926429223536207631&amp;postID=2014377605635313854' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/2014377605635313854'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/2014377605635313854'/><link rel='alternate' type='text/html' href='http://sudag.blogspot.com/2008/09/using-generic-lists-with-crystal.html' title='Using Generic lists with crystal reports in .net'/><author><name>suda</name><uri>http://www.blogger.com/profile/15635297681991446902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4926429223536207631.post-8707297361891930337</id><published>2008-09-14T22:45:00.000-07:00</published><updated>2008-09-14T22:48:36.622-07:00</updated><title type='text'>Export options of crystal reports and passing parameters to crystal reports in .net</title><content type='html'>&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:&amp;quot;;font-size:85%;color:blue;"   &gt;Public&lt;/span&gt;&lt;span style="background: silver none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:&amp;quot;;font-size:85%;"  &gt; &lt;span style="color:blue;"&gt;Sub&lt;/span&gt; ReportDocumentDetails(&lt;span style="color:blue;"&gt;ByVal&lt;/span&gt; rptPath &lt;span style="color:blue;"&gt;As&lt;/span&gt; &lt;span style="color:blue;"&gt;String&lt;/span&gt;, &lt;span style="color:blue;"&gt;ByVal&lt;/span&gt; reportname &lt;span style="color:blue;"&gt;As&lt;/span&gt; &lt;span style="color:blue;"&gt;String&lt;/span&gt;, &lt;span style="color:blue;"&gt;ByVal&lt;/span&gt; dtReport &lt;span style="color:blue;"&gt;As&lt;/span&gt; DataTable, _&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:&amp;quot;;font-size:85%;"  &gt;&lt;span style=""&gt;                                    &lt;/span&gt;&lt;span style="color:blue;"&gt;ByVal&lt;/span&gt; arListName &lt;span style="color:blue;"&gt;As&lt;/span&gt; System.Collections.ArrayList, &lt;span style="color:blue;"&gt;ByVal&lt;/span&gt; arListValue &lt;span style="color:blue;"&gt;As&lt;/span&gt; System.Collections.ArrayList)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:&amp;quot;;font-size:85%;"  &gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;span style="color:blue;"&gt;Dim&lt;/span&gt; rptViewer &lt;span style="color:blue;"&gt;As&lt;/span&gt; &lt;span style="color:blue;"&gt;New&lt;/span&gt; CrystalDecisions.Windows.Forms.CrystalReportViewer()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:&amp;quot;;font-size:85%;"  &gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;span style="color:blue;"&gt;Dim&lt;/span&gt; ds &lt;span style="color:blue;"&gt;As&lt;/span&gt; DatasetReport = &lt;span style="color:blue;"&gt;New&lt;/span&gt; DatasetReport&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:&amp;quot;;font-size:85%;"  &gt;&lt;span style=""&gt;      &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:&amp;quot;;font-size:85%;"  &gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;span style="color:blue;"&gt;Dim&lt;/span&gt; rptdoc &lt;span style="color:blue;"&gt;As&lt;/span&gt; CrystalDecisions.CrystalReports.Engine.ReportDocument = &lt;span style="color:blue;"&gt;New&lt;/span&gt; CrystalDecisions.CrystalReports.Engine.ReportDocument&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:&amp;quot;;font-size:85%;"  &gt;&lt;span style=""&gt;        &lt;/span&gt;rptdoc.Load(rptPath)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:&amp;quot;;font-size:85%;"  &gt;&lt;span style=""&gt;        &lt;/span&gt;rptdoc.SetDataSource(&lt;span style="color:blue;"&gt;CType&lt;/span&gt;(dtReport, DataTable))&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:&amp;quot;;font-size:85%;"  &gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;span style="color:blue;"&gt;If&lt;/span&gt; (arListName.Count = arListValue.Count) &lt;span style="color:blue;"&gt;Then&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:&amp;quot;;font-size:85%;"  &gt;&lt;span style=""&gt;            &lt;/span&gt;&lt;span style="color:blue;"&gt;For&lt;/span&gt; i &lt;span style="color:blue;"&gt;As&lt;/span&gt; &lt;span style="color:blue;"&gt;Integer&lt;/span&gt; = 0 &lt;span style="color:blue;"&gt;To&lt;/span&gt; arListName.Count - 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:&amp;quot;;font-size:85%;"  &gt;&lt;span style=""&gt;                &lt;/span&gt;rptdoc.SetParameterValue(arListName(i).ToString, arListValue(i))&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:&amp;quot;;font-size:85%;"  &gt;&lt;span style=""&gt;            &lt;/span&gt;&lt;span style="color:blue;"&gt;Next&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:&amp;quot;;font-size:85%;"  &gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;span style="color:blue;"&gt;End&lt;/span&gt; &lt;span style="color:blue;"&gt;If&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:&amp;quot;;font-size:85%;color:blue;"   &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:&amp;quot;;font-size:85%;"  &gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;span style="color:blue;"&gt;Dim&lt;/span&gt; objExOpt &lt;span style="color:blue;"&gt;As&lt;/span&gt; CrystalDecisions.Shared.ExportOptions&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:&amp;quot;;font-size:85%;"  &gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;span style="color:blue;"&gt;Dim&lt;/span&gt; objDiskOpt &lt;span style="color:blue;"&gt;As&lt;/span&gt; &lt;span style="color:blue;"&gt;New&lt;/span&gt; CrystalDecisions.Shared.DiskFileDestinationOptions&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:&amp;quot;;font-size:85%;"  &gt;&lt;span style=""&gt;        &lt;/span&gt;objDiskOpt.DiskFileName = &lt;span style="color:maroon;"&gt;"F:\nath\"&lt;/span&gt; &amp;amp; reportname &amp;amp; &lt;span style="color:maroon;"&gt;".pdf"&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:&amp;quot;;font-size:85%;"  &gt;&lt;span style=""&gt;        &lt;/span&gt;objExOpt = rptdoc.ExportOptions&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:&amp;quot;;font-size:85%;"  &gt;&lt;span style=""&gt;        &lt;/span&gt;objExOpt.ExportDestinationType = CrystalDecisions.Shared.ExportDestinationType.DiskFile&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:&amp;quot;;font-size:85%;"  &gt;&lt;span style=""&gt;        &lt;/span&gt;objExOpt.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.PortableDocFormat&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:&amp;quot;;font-size:85%;"  &gt;&lt;span style=""&gt;        &lt;/span&gt;objExOpt.DestinationOptions = objDiskOpt&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:&amp;quot;;font-size:85%;"  &gt;&lt;span style=""&gt;        &lt;/span&gt;rptdoc.Export(objExOpt)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:&amp;quot;;font-size:85%;"  &gt;&lt;span style=""&gt;        &lt;/span&gt;rptdoc.Close()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:&amp;quot;;font-size:85%;"  &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; line-height: 115%;font-family:&amp;quot;;font-size:85%;"  &gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;span style="color:blue;"&gt;End&lt;/span&gt; &lt;span style="color:blue;"&gt;Sub&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4926429223536207631-8707297361891930337?l=sudag.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudag.blogspot.com/feeds/8707297361891930337/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4926429223536207631&amp;postID=8707297361891930337' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/8707297361891930337'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/8707297361891930337'/><link rel='alternate' type='text/html' href='http://sudag.blogspot.com/2008/09/export-options-of-crystal-reports-and.html' title='Export options of crystal reports and passing parameters to crystal reports in .net'/><author><name>suda</name><uri>http://www.blogger.com/profile/15635297681991446902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4926429223536207631.post-7684065670389956272</id><published>2008-09-08T02:59:00.000-07:00</published><updated>2008-09-08T03:02:18.637-07:00</updated><title type='text'>Working with Attachments in Outlook Email using .net 2.0</title><content type='html'>Dim olApp As Microsoft.Office.Interop.Outlook.Application = New ApplicationClass()&lt;br /&gt;        Dim oNameSpace As Microsoft.Office.Interop.Outlook.NameSpace = olApp.GetNamespace("MAPI")&lt;br /&gt;        Dim oOutL As New Outlook.Application&lt;br /&gt;        Dim oMail As Outlook.MailItem&lt;br /&gt;&lt;br /&gt;        Dim objFolder As MAPIFolder = oNameSpace.GetDefaultFolder(OlDefaultFolders.olFolderInbox)&lt;br /&gt;        Dim oItems As Items = objFolder.Items&lt;br /&gt;&lt;br /&gt;        Dim twmp As Integer = 15&lt;br /&gt;        Do While (twmp &gt;= 0)&lt;br /&gt;            oMail = CType(objFolder.Items((objFolder.Items.Count - twmp)), MailItem)&lt;br /&gt;            If (oMail.UnRead = True) Then&lt;br /&gt;                If (oMail.Subject = "Document") Then&lt;br /&gt;                    oMail.Attachments(1).SaveAsFile("E:\VBABonds\kaushik\" &amp;amp; oMail.Attachments(1).FileName)&lt;br /&gt;                End If&lt;br /&gt;            End If&lt;br /&gt;            twmp = (twmp - 1)&lt;br /&gt;        Loop&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4926429223536207631-7684065670389956272?l=sudag.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudag.blogspot.com/feeds/7684065670389956272/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4926429223536207631&amp;postID=7684065670389956272' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/7684065670389956272'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/7684065670389956272'/><link rel='alternate' type='text/html' href='http://sudag.blogspot.com/2008/09/working-with-attachments-in-outlook.html' title='Working with Attachments in Outlook Email using .net 2.0'/><author><name>suda</name><uri>http://www.blogger.com/profile/15635297681991446902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4926429223536207631.post-3619827859277396442</id><published>2008-09-05T03:05:00.000-07:00</published><updated>2008-09-05T03:09:01.273-07:00</updated><title type='text'>Open word file using vb.net 2,0 in windows application</title><content type='html'>&lt;img src="file:///C:/DOCUME%7E1/Gopinath/LOCALS%7E1/Temp/moz-screenshot.jpg" alt="" /&gt;&lt;img src="file:///C:/DOCUME%7E1/Gopinath/LOCALS%7E1/Temp/moz-screenshot-1.jpg" alt="" /&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=""&gt;To open ms word file using vb.net&lt;span style=""&gt;  &lt;/span&gt;2.0 in windows application &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=""&gt;Add reference  microsoft.word  12.o object from com tab.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=""&gt;&lt;!--[if gte vml 1]&gt;&lt;v:shapetype id="_x0000_t75" coordsize="21600,21600" spt="75" preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f"&gt;  &lt;v:stroke joinstyle="miter"&gt;  &lt;v:formulas&gt;   &lt;v:f eqn="if lineDrawn pixelLineWidth 0"&gt;   &lt;v:f eqn="sum @0 1 0"&gt;   &lt;v:f eqn="sum 0 0 @1"&gt;   &lt;v:f eqn="prod @2 1 2"&gt;   &lt;v:f eqn="prod @3 21600 pixelWidth"&gt;   &lt;v:f eqn="prod @3 21600 pixelHeight"&gt;   &lt;v:f eqn="sum @0 0 1"&gt;   &lt;v:f eqn="prod @6 1 2"&gt;   &lt;v:f eqn="prod @7 21600 pixelWidth"&gt;   &lt;v:f eqn="sum @8 21600 0"&gt;   &lt;v:f eqn="prod @7 21600 pixelHeight"&gt;   &lt;v:f eqn="sum @10 21600 0"&gt;  &lt;/v:formulas&gt;  &lt;v:path extrusionok="f" gradientshapeok="t" connecttype="rect"&gt;  &lt;o:lock ext="edit" aspectratio="t"&gt; &lt;/v:shapetype&gt;&lt;v:shape id="Picture_x0020_1" spid="_x0000_i1025" type="#_x0000_t75" style="'width:350.25pt;height:286.5pt;visibility:visible;mso-wrap-style:square'"&gt;  &lt;v:imagedata src="file:///C:\DOCUME~1\Gopinath\LOCALS~1\Temp\msohtmlclip1\01\clip_image001.png" title=""&gt; &lt;/v:shape&gt;&lt;![endif]--&gt;&lt;!--[if !vml]--&gt;&lt;img src="file:///C:/DOCUME%7E1/Gopinath/LOCALS%7E1/Temp/msohtmlclip1/01/clip_image002.jpg" shapes="Picture_x0020_1" height="382" width="467" /&gt;&lt;!--[endif]--&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;span style="color: blue;"&gt;If&lt;/span&gt; (System.IO.File.Exists(txtBrowse.Text)) &lt;span style="color: blue;"&gt;Then&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;            &lt;/span&gt;&lt;span style="color: blue;"&gt;Dim&lt;/span&gt; test &lt;span style="color: blue;"&gt;As&lt;/span&gt; Microsoft.Office.Interop.Word.Application&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;            &lt;/span&gt;test = &lt;span style="color: blue;"&gt;New&lt;/span&gt; Microsoft.Office.Interop.Word.Application&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;            &lt;/span&gt;test.Documents.Open(txtBrowse.Text)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;            &lt;/span&gt;test.OpenAttachmentsInFullScreen = &lt;span style="color: blue;"&gt;True&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;            &lt;/span&gt;test.Visible = &lt;span style="color: blue;"&gt;True&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; line-height: 115%; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;End&lt;/span&gt; &lt;span style="color: blue;"&gt;If&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4926429223536207631-3619827859277396442?l=sudag.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudag.blogspot.com/feeds/3619827859277396442/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4926429223536207631&amp;postID=3619827859277396442' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/3619827859277396442'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/3619827859277396442'/><link rel='alternate' type='text/html' href='http://sudag.blogspot.com/2008/09/open-word-file-using-vbnet-20-in.html' title='Open word file using vb.net 2,0 in windows application'/><author><name>suda</name><uri>http://www.blogger.com/profile/15635297681991446902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4926429223536207631.post-8379242384569770396</id><published>2008-09-04T04:00:00.000-07:00</published><updated>2008-09-04T04:10:20.157-07:00</updated><title type='text'>Storing and Downloading ms word file in ms access file using VB.NET 2.0</title><content type='html'>&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;b style=""&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Storing a ms word file in access database using VB.NET 2.0&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;    &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;b style=""&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;o:p&gt;&lt;br /&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;Dim&lt;/span&gt; objcon &lt;span style="color: blue;"&gt;As&lt;/span&gt; System.Data.OleDb.OleDbConnection = CommonFunctions.clsCommonFunctions.OleDbConnections()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;Dim&lt;/span&gt; objcmd &lt;span style="color: blue;"&gt;As&lt;/span&gt; System.Data.OleDb.OleDbCommand = &lt;span style="color: blue;"&gt;New&lt;/span&gt; OleDb.OleDbCommand(&lt;span style="color: maroon;"&gt;""&lt;/span&gt;, objcon)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;Dim&lt;/span&gt; par &lt;span style="color: blue;"&gt;As&lt;/span&gt; OleDb.OleDbParameter = &lt;span style="color: blue;"&gt;New&lt;/span&gt; OleDb.OleDbParameter(&lt;span style="color: maroon;"&gt;"@Attachment"&lt;/span&gt;, OleDb.OleDbType.LongVarBinary)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;Dim&lt;/span&gt; strText &lt;span style="color: blue;"&gt;As&lt;/span&gt; &lt;span style="color: blue;"&gt;String&lt;/span&gt; = &lt;span style="color: maroon;"&gt;"update bonds set Attachment=@Attachment where bondsid="&lt;/span&gt; &amp;amp; txtDBaseRefNo.Text&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;        &lt;/span&gt;objcon.Open()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;      &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;Dim&lt;/span&gt; fs &lt;span style="color: blue;"&gt;As&lt;/span&gt; &lt;span style="color: blue;"&gt;New&lt;/span&gt; System.IO.FileStream _&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;   &lt;/span&gt;&lt;span style=""&gt;      &lt;/span&gt;(TextBox1.Text, System.IO.FileMode.OpenOrCreate, _&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;          &lt;/span&gt;System.IO.FileAccess.Read)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;Dim&lt;/span&gt; MyData(fs.Length) &lt;span style="color: blue;"&gt;As&lt;/span&gt; &lt;span style="color: blue;"&gt;Byte&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;        &lt;/span&gt;fs.Read(MyData, 0, fs.Length)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;        &lt;/span&gt;fs.Close()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;        &lt;/span&gt;par.Value = MyData&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;        &lt;/span&gt;objcmd.CommandText = strText&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt; &lt;/span&gt;&lt;span style=""&gt;       &lt;/span&gt;objcmd.Parameters.Add(par)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;Dim&lt;/span&gt; i &lt;span style="color: blue;"&gt;As&lt;/span&gt; &lt;span style="color: blue;"&gt;Integer&lt;/span&gt; = objcmd.ExecuteNonQuery()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;        &lt;/span&gt;fs = &lt;span style="color: blue;"&gt;Nothing&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;        &lt;/span&gt;objcon.Close()&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;  &lt;/p&gt;&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;b style=""&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;Downloading ms word file from ms access database using VB.NET 2.0&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;o:p&gt;&lt;br /&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;Dim&lt;/span&gt; objcon &lt;span style="color: blue;"&gt;As&lt;/span&gt; System.Data.OleDb.OleDbConnection = CommonFunctions.clsCommonFunctions.OleDbConnections()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;     &lt;/span&gt;&lt;span style=""&gt;   &lt;/span&gt;&lt;span style="color: blue;"&gt;Dim&lt;/span&gt; command &lt;span style="color: blue;"&gt;As&lt;/span&gt; System.Data.OleDb.OleDbCommand = &lt;span style="color: blue;"&gt;New&lt;/span&gt; System.Data.OleDb.OleDbCommand( _&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;   &lt;/span&gt;&lt;span style="color: maroon;"&gt;"select Attachment from&lt;span style=""&gt;  &lt;/span&gt;bonds where bondsid="&lt;/span&gt; &amp;amp; txtDBaseRefNo.Text, objcon)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;span style="color: green;"&gt;' Writes the BLOB to a file (*.bmp).&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;Dim&lt;/span&gt; stream &lt;span style="color: blue;"&gt;As&lt;/span&gt; System.IO.FileStream&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;span style="color: green;"&gt;' Streams the binary data to the FileStream object.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;Dim&lt;/span&gt; writer &lt;span style="color: blue;"&gt;As&lt;/span&gt; System.IO.BinaryWriter&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;span style="color: green;"&gt;' The size of the BLOB buffer.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;Dim&lt;/span&gt; bufferSize &lt;span style="color: blue;"&gt;As&lt;/span&gt; &lt;span style="color: blue;"&gt;Integer&lt;/span&gt; = 100&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;span style="color: green;"&gt;' The BLOB byte() buffer to be filled by GetBytes.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;Dim&lt;/span&gt; outByte(bufferSize - 1) &lt;span style="color: blue;"&gt;As&lt;/span&gt; &lt;span style="color: blue;"&gt;Byte&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;span style="color: green;"&gt;' The bytes returned from GetBytes.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;Dim&lt;/span&gt; retval &lt;span style="color: blue;"&gt;As&lt;/span&gt; &lt;span style="color: blue;"&gt;Long&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;span style="color: green;"&gt;' The starting position in the BLOB output.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;Dim&lt;/span&gt; startIndex &lt;span style="color: blue;"&gt;As&lt;/span&gt; &lt;span style="color: blue;"&gt;Long&lt;/span&gt; = 0&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;span style="color: green;"&gt;' The publisher id to use in the file name.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;Dim&lt;/span&gt; pubID &lt;span style="color: blue;"&gt;As&lt;/span&gt; &lt;span style="color: blue;"&gt;String&lt;/span&gt; = &lt;span style="color: maroon;"&gt;""&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;span style="color: green;"&gt;' Open the connection and read data into the DataReader.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;        &lt;/span&gt;objcon.Open()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;Dim&lt;/span&gt; reader &lt;span style="color: blue;"&gt;As&lt;/span&gt; System.Data.OleDb.OleDbDataReader = command.ExecuteReader(CommandBehavior.SequentialAccess)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;Do&lt;/span&gt; &lt;span style="color: blue;"&gt;While&lt;/span&gt; reader.Read()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;            &lt;/span&gt;&lt;span style="color: green;"&gt;' Get the publisher id, which must occur before getting the logo.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;            &lt;/span&gt;&lt;span style="color: green;"&gt;'pubID = reader.GetString(0)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;            &lt;/span&gt;&lt;span style="color: green;"&gt;' Create a file to hold the output.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;            &lt;/span&gt;stream = &lt;span style="color: blue;"&gt;New&lt;/span&gt; System.IO.FileStream( _&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;              &lt;/span&gt;&lt;span style="color: maroon;"&gt;"C:\Documents and Settings\Gopinath\Desktop\doccc1111.doc"&lt;/span&gt;, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.Write)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;            &lt;/span&gt;writer = &lt;span style="color: blue;"&gt;New&lt;/span&gt; System.IO.BinaryWriter(stream)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;            &lt;/span&gt;&lt;span style="color: green;"&gt;' Reset the starting byte for a new BLOB.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;            &lt;/span&gt;startIndex = 0&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;            &lt;/span&gt;&lt;span style="color: green;"&gt;' Read bytes into outByte() and retain the number of bytes returned.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;            &lt;/span&gt;retval = reader.GetBytes(0, startIndex, outByte, 0, bufferSize)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;            &lt;/span&gt;&lt;span style="color: green;"&gt;' Continue while there are bytes beyond the size of the buffer.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;            &lt;/span&gt;&lt;span style="color: blue;"&gt;Do&lt;/span&gt; &lt;span style="color: blue;"&gt;While&lt;/span&gt; retval = bufferSize&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;                &lt;/span&gt;writer.Write(outByte)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;                &lt;/span&gt;writer.Flush()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;                &lt;/span&gt;&lt;span style="color: green;"&gt;' Reposition start index to end of the last buffer and fill buffer.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;                &lt;/span&gt;startIndex += bufferSize&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;                &lt;/span&gt;retval = reader.GetBytes(0, startIndex, outByte, 0, bufferSize)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;            &lt;/span&gt;&lt;span style="color: blue;"&gt;Loop&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;            &lt;/span&gt;&lt;span style="color: green;"&gt;' Write the remaining buffer.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;            &lt;/span&gt;writer.Write(outByte, 0, retval - 1)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;            &lt;/span&gt;writer.Flush()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;            &lt;/span&gt;&lt;span style="color: green;"&gt;' Close the output file.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;            &lt;/span&gt;writer.Close()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;            &lt;/span&gt;stream.Close()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;Loop&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;span style="color: green;"&gt;' Close the reader and the connection.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;        &lt;/span&gt;reader.Close()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;        &lt;/span&gt;objcon.Close()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;br /&gt;&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;br /&gt;&lt;span style="background: silver none repeat scroll 0% 50%; font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4926429223536207631-8379242384569770396?l=sudag.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudag.blogspot.com/feeds/8379242384569770396/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4926429223536207631&amp;postID=8379242384569770396' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/8379242384569770396'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/8379242384569770396'/><link rel='alternate' type='text/html' href='http://sudag.blogspot.com/2008/09/storing-and-downloading-ms-word-file-in.html' title='Storing and Downloading ms word file in ms access file using VB.NET 2.0'/><author><name>suda</name><uri>http://www.blogger.com/profile/15635297681991446902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4926429223536207631.post-8685170319548149496</id><published>2008-09-02T06:02:00.000-07:00</published><updated>2008-09-02T06:03:22.647-07:00</updated><title type='text'>Run Executable file in ASP.NET</title><content type='html'>i will provide a code snippet of how to run a process (in this case it is WindowsMediaPlayer.exe) which exists in your application root folder. &lt;p&gt;// Create An instance of the Process class responsible for starting the newly process.&lt;/p&gt; &lt;p&gt;&lt;span style="font-family:Verdana;"&gt;System.Diagnostics.Process process1 = &lt;span style="color: blue;"&gt;new&lt;/span&gt; System.Diagnostics.Process();&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family:Verdana;"&gt;// Set the directory where the file resides&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;process1.StartInfo.WorkingDirectory = Request.MapPath("~/"); &lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;// Set the filename name of the file you want to open&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;process1.StartInfo.FileName = Request.MapPath("WindowsMediaPlayer.exe");&lt;span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span&gt;// Start the process&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;process1.Start(); &lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4926429223536207631-8685170319548149496?l=sudag.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudag.blogspot.com/feeds/8685170319548149496/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4926429223536207631&amp;postID=8685170319548149496' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/8685170319548149496'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/8685170319548149496'/><link rel='alternate' type='text/html' href='http://sudag.blogspot.com/2008/09/run-executable-file-in-aspnet.html' title='Run Executable file in ASP.NET'/><author><name>suda</name><uri>http://www.blogger.com/profile/15635297681991446902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4926429223536207631.post-9089603607233095743</id><published>2008-09-02T06:01:00.000-07:00</published><updated>2008-09-02T06:02:24.828-07:00</updated><title type='text'>Run a .EXE from a VB.NET application?</title><content type='html'>To run a .EXE file from a VB.NET application you need to import the &lt;strong&gt;System.Diagnostics namespace&lt;/strong&gt;. The following sample shows how to run Notepad from a VB.NET application.   &lt;pre class="sourcecode"&gt;&lt;br /&gt;Imports System&lt;br /&gt;Imports System.Diagnostics&lt;br /&gt;Dim program As New Process()&lt;br /&gt;program.StartInfo.FileName = "Notepad.exe"&lt;br /&gt;program.StartInfo.Arguments = " "&lt;br /&gt;program.Start()&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4926429223536207631-9089603607233095743?l=sudag.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudag.blogspot.com/feeds/9089603607233095743/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4926429223536207631&amp;postID=9089603607233095743' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/9089603607233095743'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/9089603607233095743'/><link rel='alternate' type='text/html' href='http://sudag.blogspot.com/2008/09/run-exe-from-vbnet-application.html' title='Run a .EXE from a VB.NET application?'/><author><name>suda</name><uri>http://www.blogger.com/profile/15635297681991446902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4926429223536207631.post-4319482926017621303</id><published>2008-08-28T05:35:00.000-07:00</published><updated>2008-08-28T05:40:41.299-07:00</updated><title type='text'>Validating Email id using Regular Expression in vb.net</title><content type='html'>&lt;p class="MsoNormal"&gt;  &lt;/p&gt;&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;   &lt;/span&gt;&lt;span style="color:blue;"&gt;Dim&lt;/span&gt; m &lt;span style="color:blue;"&gt;As&lt;/span&gt; System.Text.RegularExpressions.Regex = &lt;span style="color:blue;"&gt;New&lt;/span&gt; System.Text.RegularExpressions.Regex(&lt;span style="color:maroon;"&gt;"^((?&gt;[a-zA-Z\d!#$%&amp;amp;'*+\-/=?^_`{|}~]"&lt;/span&gt; &amp;amp; _&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt; &lt;/span&gt;&lt;span style="color:maroon;"&gt;"+\x20*|""((?=[\x01-\x7f])"&lt;/span&gt; &amp;amp; _&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt; &lt;/span&gt;&lt;span style="color:maroon;"&gt;"[^""\\]|\\[\x01-\x7f])*""\x20*)*(?&lt;angle&gt;&lt;))?((?!\.)" &amp;amp; _ "(?&gt;\.?[a-zA-Z\d!#$%&amp;amp;'*+\-/=?^_`{|}~]+)+|""((?=[\x01-\x7f])[^""\\]"&lt;/angle&gt;&lt;/span&gt; &amp;amp; _&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;span style="color:maroon;"&gt;"|\\[\x01-\x7f])*"")@(((?!-)[a-zA-Z\d\-]+(?&lt;!--)\.)+[a-zA-Z]{2,}" &amp;amp; _ "|\[(((?(?&lt;!\[)\.)(25[0-5]|2[0-4]\d|[01]?\d?\d))"&lt;/span--&gt; &amp;amp; _&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt; &lt;/span&gt;&lt;span style="color:maroon;"&gt;"{4}|[a-zA-Z\d\-]*[a-zA-Z\d]:((?=[\x01-\x7f])[^\\\[\]]|\\[\x01-\x7f])+)\])(?(angle)&gt;)$"&lt;/span&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;span style="color:blue;"&gt;Dim&lt;/span&gt; isMatch &lt;span style="color:blue;"&gt;As&lt;/span&gt; &lt;span style="color:blue;"&gt;Boolean&lt;/span&gt; = m.IsMatch(txtBrokerEmail.Text) &lt;span style="color:green;"&gt;'INPUT&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="background: silver none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;&lt;span style=""&gt;        &lt;/span&gt;MsgBox(isMatch.ToString())&lt;/span&gt;&lt;span style="font-size:9;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 115%;font-size:85%;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4926429223536207631-4319482926017621303?l=sudag.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudag.blogspot.com/feeds/4319482926017621303/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4926429223536207631&amp;postID=4319482926017621303' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/4319482926017621303'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/4319482926017621303'/><link rel='alternate' type='text/html' href='http://sudag.blogspot.com/2008/08/validating-email-id-using-regular.html' title='Validating Email id using Regular Expression in vb.net'/><author><name>suda</name><uri>http://www.blogger.com/profile/15635297681991446902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4926429223536207631.post-8536681709837498492</id><published>2008-08-26T00:56:00.000-07:00</published><updated>2008-08-26T00:57:35.417-07:00</updated><title type='text'>Excel Reports in ASP.NET 2.0</title><content type='html'>&lt;h1&gt;&lt;span id="ctl00_MiddleContent_txtSummary" style="font-weight: normal;"&gt;In this article you will learn how to read data from Excel, generate report using the Response objects and to play with the Microsoft Excel 11.0 objects involved. Indeed, it is impossible to cover all features in this tutorial but many important techniques were covered to help you down the line. It is up to you to be creative and adapt the techniques to your scenarios.&lt;/span&gt;&lt;/h1&gt;           &lt;br /&gt;    &lt;table id="ctl00_MiddleContent_TableTopAds" style="border-style: none; width: 600px; border-collapse: collapse;" align="center" border="0" cellpadding="3" cellspacing="0"&gt;    &lt;tbody&gt;&lt;tr&gt;     &lt;td align="left" valign="top"&gt;    &lt;script type="text/javascript" src="http://www.eggheadcafe.com/adhandler.ashx?categoryid=1&amp;amp;zoneid=1"&gt;&lt;/script&gt;&lt;table border="0"&gt; &lt;tbody&gt;&lt;tr&gt;  &lt;td align="left" valign="top"&gt;&lt;a class="sidelink" href="http://www.analysttool.com/&amp;amp;productid=16348"&gt;Analyst Real Team System (ARTS) 7.0&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt;  &lt;td align="left" valign="top"&gt;Analyst Real Team System (ARTS) provides a complete set of tools for modeling the various artifact types of system development. ARTS provides a uniform approach to modeling use cases, test cases, business rules, bugs, tasks, and more. The result is a unique and coherent framework for successful system development by anyone using the software.&lt;/td&gt; &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;       &lt;/td&gt;    &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;                     &lt;h2&gt;Introduction&lt;/h2&gt; &lt;p class="ArticleText"&gt;Excel is such a powerful tool that almost all companies make extensive use of it for analyzing data. Moreover, the internet is not as it was 10 years ago. Almost all pages that are out there on the internet are dynamic ones, that is, interacts with a database in backend to produce results. Sometimes, data that are displayed, if made available on in an Excel file, proper analysis of the data often helps in making more accurate decisions by using Excel features. In this tutorial, we will learn how to interact with Excel files, both reading and writing.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt; &lt;h2&gt;Excel - ASP.NET Scenarios&lt;/h2&gt; &lt;p class="ArticleText"&gt;For the purpose of this tutorial, an Excel sheet had been prepared that holds record of students and their respective marks in subjects. Please note that these records are fictitious and had been input randomly.&lt;/p&gt; &lt;div align="center"&gt; &lt;table id="table1" style="width: 167.65pt; border-collapse: collapse;" border="0" cellpadding="0" cellspacing="0" width="224"&gt; &lt;tbody&gt; &lt;tr style="height: 12.75pt;"&gt; &lt;td style="padding: 0cm 5.4pt; width: 56.95pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="76"&gt; &lt;p class="ArticleText" style="text-align: center;" align="center"&gt;&lt;b&gt;&lt;span&gt;StudentId&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;/td&gt; &lt;td style="padding: 0cm 5.4pt; width: 110.7pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="148"&gt; &lt;p class="ArticleText"&gt;&lt;b&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;StudentName&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr style="height: 12.75pt;"&gt; &lt;td style="padding: 0cm 5.4pt; width: 56.95pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="76"&gt; &lt;p class="ArticleText" style="text-align: right;" align="right"&gt;&lt;span&gt;10001&lt;/span&gt;&lt;/p&gt;&lt;/td&gt; &lt;td style="padding: 0cm 5.4pt; width: 110.7pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="148"&gt; &lt;p class="ArticleText"&gt;&lt;span&gt;John Thomas&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr style="height: 12.75pt;"&gt; &lt;td style="padding: 0cm 5.4pt; width: 56.95pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="76"&gt; &lt;p class="ArticleText" style="text-align: right;" align="right"&gt;&lt;span&gt;10002&lt;/span&gt;&lt;/p&gt;&lt;/td&gt; &lt;td style="padding: 0cm 5.4pt; width: 110.7pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="148"&gt; &lt;p class="ArticleText"&gt;&lt;span&gt;Terry Lane&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr style="height: 12.75pt;"&gt; &lt;td style="padding: 0cm 5.4pt; width: 56.95pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="76"&gt; &lt;p class="ArticleText" style="text-align: right;" align="right"&gt;&lt;span&gt;10003&lt;/span&gt;&lt;/p&gt;&lt;/td&gt; &lt;td style="padding: 0cm 5.4pt; width: 110.7pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="148"&gt; &lt;p class="ArticleText"&gt;&lt;span&gt;Anne Marie&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr style="height: 12.75pt;"&gt; &lt;td style="padding: 0cm 5.4pt; width: 56.95pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="76"&gt; &lt;p class="ArticleText" style="text-align: right;" align="right"&gt;&lt;span&gt;10004&lt;/span&gt;&lt;/p&gt;&lt;/td&gt; &lt;td style="padding: 0cm 5.4pt; width: 110.7pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="148"&gt; &lt;p class="ArticleText"&gt;&lt;span&gt;Tom Sawyer&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr style="height: 12.75pt;"&gt; &lt;td style="padding: 0cm 5.4pt; width: 56.95pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="76"&gt; &lt;p class="ArticleText" style="text-align: right;" align="right"&gt;&lt;span&gt;10005&lt;/span&gt;&lt;/p&gt;&lt;/td&gt; &lt;td style="padding: 0cm 5.4pt; width: 110.7pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="148"&gt; &lt;p class="ArticleText"&gt;&lt;span&gt;Derek Ince&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr style="height: 12.75pt;"&gt; &lt;td style="padding: 0cm 5.4pt; width: 56.95pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="76"&gt; &lt;p class="ArticleText" style="text-align: right;" align="right"&gt;&lt;span&gt;10006&lt;/span&gt;&lt;/p&gt;&lt;/td&gt; &lt;td style="padding: 0cm 5.4pt; width: 110.7pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="148"&gt; &lt;p class="ArticleText"&gt;&lt;span&gt;Emerson Boyce&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr style="height: 12.75pt;"&gt; &lt;td style="padding: 0cm 5.4pt; width: 56.95pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="76"&gt; &lt;p class="ArticleText" style="text-align: right;" align="right"&gt;&lt;span&gt;10007&lt;/span&gt;&lt;/p&gt;&lt;/td&gt; &lt;td style="padding: 0cm 5.4pt; width: 110.7pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="148"&gt; &lt;p class="ArticleText"&gt;&lt;span&gt;Thommas Kolka&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr style="height: 12.75pt;"&gt; &lt;td style="padding: 0cm 5.4pt; width: 56.95pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="76"&gt; &lt;p class="ArticleText" style="text-align: right;" align="right"&gt;&lt;span&gt;10008&lt;/span&gt;&lt;/p&gt;&lt;/td&gt; &lt;td style="padding: 0cm 5.4pt; width: 110.7pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="148"&gt; &lt;p class="ArticleText"&gt;&lt;span&gt;Edison Hall&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr style="height: 12.75pt;"&gt; &lt;td style="padding: 0cm 5.4pt; width: 56.95pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="76"&gt; &lt;p class="ArticleText" style="text-align: right;" align="right"&gt;&lt;span&gt;10009&lt;/span&gt;&lt;/p&gt;&lt;/td&gt; &lt;td style="padding: 0cm 5.4pt; width: 110.7pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="148"&gt; &lt;p class="ArticleText"&gt;&lt;span&gt;Teddy Harewood&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr style="height: 12.75pt;"&gt; &lt;td style="padding: 0cm 5.4pt; width: 56.95pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="76"&gt; &lt;p class="ArticleText" style="text-align: right;" align="right"&gt;&lt;span&gt;10010&lt;/span&gt;&lt;/p&gt;&lt;/td&gt; &lt;td style="padding: 0cm 5.4pt; width: 110.7pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="148"&gt; &lt;p class="ArticleText"&gt;&lt;span&gt;Williams Yorkshire&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt; &lt;p class="ArticleText"&gt;Fig 1. Table holding information for students&lt;/p&gt;&lt;/div&gt; &lt;div align="center"&gt; &lt;table id="table2" style="width: 104.95pt; border-collapse: collapse;" border="0" cellpadding="0" cellspacing="0" width="140"&gt; &lt;tbody&gt; &lt;tr style="height: 12.75pt;"&gt; &lt;td style="padding: 0cm 5.4pt; width: 56.95pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="76"&gt; &lt;p class="ArticleText"&gt;&lt;b&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;StudentId&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;/td&gt; &lt;td style="padding: 0cm 5.4pt; width: 48pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="64"&gt; &lt;p class="ArticleText"&gt;&lt;b&gt;&lt;span style="font-size: 10pt; font-family: Arial;"&gt;Marks&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr style="height: 12.75pt;"&gt; &lt;td style="padding: 0cm 5.4pt; width: 56.95pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="76"&gt; &lt;p class="ArticleText" style="text-align: right;" align="right"&gt;&lt;span&gt;10001&lt;/span&gt;&lt;/p&gt;&lt;/td&gt; &lt;td style="padding: 0cm 5.4pt; width: 48pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="64"&gt; &lt;p class="ArticleText" style="text-align: right;" align="right"&gt;&lt;span&gt;50&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr style="height: 12.75pt;"&gt; &lt;td style="padding: 0cm 5.4pt; width: 56.95pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="76"&gt; &lt;p class="ArticleText" style="text-align: right;" align="right"&gt;&lt;span&gt;10002&lt;/span&gt;&lt;/p&gt;&lt;/td&gt; &lt;td style="padding: 0cm 5.4pt; width: 48pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="64"&gt; &lt;p class="ArticleText" style="text-align: right;" align="right"&gt;&lt;span&gt;60&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr style="height: 12.75pt;"&gt; &lt;td style="padding: 0cm 5.4pt; width: 56.95pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="76"&gt; &lt;p class="ArticleText" style="text-align: right;" align="right"&gt;&lt;span&gt;10003&lt;/span&gt;&lt;/p&gt;&lt;/td&gt; &lt;td style="padding: 0cm 5.4pt; width: 48pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="64"&gt; &lt;p class="ArticleText" style="text-align: right;" align="right"&gt;&lt;span&gt;75&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr style="height: 12.75pt;"&gt; &lt;td style="padding: 0cm 5.4pt; width: 56.95pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="76"&gt; &lt;p class="ArticleText" style="text-align: right;" align="right"&gt;&lt;span&gt;10004&lt;/span&gt;&lt;/p&gt;&lt;/td&gt; &lt;td style="padding: 0cm 5.4pt; width: 48pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="64"&gt; &lt;p class="ArticleText" style="text-align: right;" align="right"&gt;&lt;span&gt;80&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr style="height: 12.75pt;"&gt; &lt;td style="padding: 0cm 5.4pt; width: 56.95pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="76"&gt; &lt;p class="ArticleText" style="text-align: right;" align="right"&gt;&lt;span&gt;10005&lt;/span&gt;&lt;/p&gt;&lt;/td&gt; &lt;td style="padding: 0cm 5.4pt; width: 48pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="64"&gt; &lt;p class="ArticleText" style="text-align: right;" align="right"&gt;&lt;span&gt;90&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr style="height: 12.75pt;"&gt; &lt;td style="padding: 0cm 5.4pt; width: 56.95pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="76"&gt; &lt;p class="ArticleText" style="text-align: right;" align="right"&gt;&lt;span&gt;10006&lt;/span&gt;&lt;/p&gt;&lt;/td&gt; &lt;td style="padding: 0cm 5.4pt; width: 48pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="64"&gt; &lt;p class="ArticleText" style="text-align: right;" align="right"&gt;&lt;span&gt;95&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr style="height: 12.75pt;"&gt; &lt;td style="padding: 0cm 5.4pt; width: 56.95pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="76"&gt; &lt;p class="ArticleText" style="text-align: right;" align="right"&gt;&lt;span&gt;10007&lt;/span&gt;&lt;/p&gt;&lt;/td&gt; &lt;td style="padding: 0cm 5.4pt; width: 48pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="64"&gt; &lt;p class="ArticleText" style="text-align: right;" align="right"&gt;&lt;span&gt;100&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr style="height: 12.75pt;"&gt; &lt;td style="padding: 0cm 5.4pt; width: 56.95pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="76"&gt; &lt;p class="ArticleText" style="text-align: right;" align="right"&gt;&lt;span&gt;10008&lt;/span&gt;&lt;/p&gt;&lt;/td&gt; &lt;td style="padding: 0cm 5.4pt; width: 48pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="64"&gt; &lt;p class="ArticleText" style="text-align: right;" align="right"&gt;&lt;span&gt;20&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr style="height: 12.75pt;"&gt; &lt;td style="padding: 0cm 5.4pt; width: 56.95pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="76"&gt; &lt;p class="ArticleText" style="text-align: right;" align="right"&gt;&lt;span&gt;10009&lt;/span&gt;&lt;/p&gt;&lt;/td&gt; &lt;td style="padding: 0cm 5.4pt; width: 48pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="64"&gt; &lt;p class="ArticleText" style="text-align: right;" align="right"&gt;&lt;span&gt;48&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr style="height: 12.75pt;"&gt; &lt;td style="padding: 0cm 5.4pt; width: 56.95pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="76"&gt; &lt;p class="ArticleText" style="text-align: right;" align="right"&gt;&lt;span&gt;10010&lt;/span&gt;&lt;/p&gt;&lt;/td&gt; &lt;td style="padding: 0cm 5.4pt; width: 48pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="64"&gt; &lt;p class="ArticleText" style="text-align: right;" align="right"&gt;&lt;span&gt;66&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt; &lt;p class="ArticleText"&gt;Fig 2. Table holding student marks in Mathematics subject&lt;/p&gt;&lt;/div&gt; &lt;div align="center"&gt; &lt;table id="table3" style="width: 110.5pt; border-collapse: collapse;" border="0" cellpadding="0" cellspacing="0" width="147"&gt; &lt;tbody&gt; &lt;tr style="height: 12.75pt;"&gt; &lt;td style="padding: 0cm 5.4pt; width: 62.5pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="83"&gt; &lt;p class="ArticleText" style="text-align: center;" align="center"&gt;&lt;b&gt;&lt;span&gt;StudentId&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;/td&gt; &lt;td style="padding: 0cm 5.4pt; width: 48pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="64"&gt; &lt;p class="ArticleText" style="text-align: center;" align="center"&gt;&lt;b&gt;&lt;span&gt;Marks&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr style="height: 12.75pt;"&gt; &lt;td style="padding: 0cm 5.4pt; width: 62.5pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="83"&gt; &lt;p class="ArticleText" style="text-align: right;" align="right"&gt;&lt;span&gt;10001&lt;/span&gt;&lt;/p&gt;&lt;/td&gt; &lt;td style="padding: 0cm 5.4pt; width: 48pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="64"&gt; &lt;p class="ArticleText" style="text-align: right;" align="right"&gt;&lt;span&gt;30&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr style="height: 12.75pt;"&gt; &lt;td style="padding: 0cm 5.4pt; width: 62.5pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="83"&gt; &lt;p class="ArticleText" style="text-align: right;" align="right"&gt;&lt;span&gt;10002&lt;/span&gt;&lt;/p&gt;&lt;/td&gt; &lt;td style="padding: 0cm 5.4pt; width: 48pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="64"&gt; &lt;p class="ArticleText" style="text-align: right;" align="right"&gt;&lt;span&gt;25&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr style="height: 12.75pt;"&gt; &lt;td style="padding: 0cm 5.4pt; width: 62.5pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="83"&gt; &lt;p class="ArticleText" style="text-align: right;" align="right"&gt;&lt;span&gt;10003&lt;/span&gt;&lt;/p&gt;&lt;/td&gt; &lt;td style="padding: 0cm 5.4pt; width: 48pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="64"&gt; &lt;p class="ArticleText" style="text-align: right;" align="right"&gt;&lt;span&gt;65&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr style="height: 12.75pt;"&gt; &lt;td style="padding: 0cm 5.4pt; width: 62.5pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="83"&gt; &lt;p class="ArticleText" style="text-align: right;" align="right"&gt;&lt;span&gt;10004&lt;/span&gt;&lt;/p&gt;&lt;/td&gt; &lt;td style="padding: 0cm 5.4pt; width: 48pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="64"&gt; &lt;p class="ArticleText" style="text-align: right;" align="right"&gt;&lt;span&gt;78&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr style="height: 12.75pt;"&gt; &lt;td style="padding: 0cm 5.4pt; width: 62.5pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="83"&gt; &lt;p class="ArticleText" style="text-align: right;" align="right"&gt;&lt;span&gt;10005&lt;/span&gt;&lt;/p&gt;&lt;/td&gt; &lt;td style="padding: 0cm 5.4pt; width: 48pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="64"&gt; &lt;p class="ArticleText" style="text-align: right;" align="right"&gt;&lt;span&gt;95&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr style="height: 12.75pt;"&gt; &lt;td style="padding: 0cm 5.4pt; width: 62.5pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="83"&gt; &lt;p class="ArticleText" style="text-align: right;" align="right"&gt;&lt;span&gt;10006&lt;/span&gt;&lt;/p&gt;&lt;/td&gt; &lt;td style="padding: 0cm 5.4pt; width: 48pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="64"&gt; &lt;p class="ArticleText" style="text-align: right;" align="right"&gt;&lt;span&gt;64&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr style="height: 12.75pt;"&gt; &lt;td style="padding: 0cm 5.4pt; width: 62.5pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="83"&gt; &lt;p class="ArticleText" style="text-align: right;" align="right"&gt;&lt;span&gt;10007&lt;/span&gt;&lt;/p&gt;&lt;/td&gt; &lt;td style="padding: 0cm 5.4pt; width: 48pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="64"&gt; &lt;p class="ArticleText" style="text-align: right;" align="right"&gt;&lt;span&gt;32&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr style="height: 12.75pt;"&gt; &lt;td style="padding: 0cm 5.4pt; width: 62.5pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="83"&gt; &lt;p class="ArticleText" style="text-align: right;" align="right"&gt;&lt;span&gt;10008&lt;/span&gt;&lt;/p&gt;&lt;/td&gt; &lt;td style="padding: 0cm 5.4pt; width: 48pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="64"&gt; &lt;p class="ArticleText" style="text-align: right;" align="right"&gt;&lt;span&gt;88&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr style="height: 12.75pt;"&gt; &lt;td style="padding: 0cm 5.4pt; width: 62.5pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="83"&gt; &lt;p class="ArticleText" style="text-align: right;" align="right"&gt;&lt;span&gt;10009&lt;/span&gt;&lt;/p&gt;&lt;/td&gt; &lt;td style="padding: 0cm 5.4pt; width: 48pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="64"&gt; &lt;p class="ArticleText" style="text-align: right;" align="right"&gt;&lt;span&gt;95&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr style="height: 12.75pt;"&gt; &lt;td style="padding: 0cm 5.4pt; width: 62.5pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="83"&gt; &lt;p class="ArticleText" style="text-align: right;" align="right"&gt;&lt;span&gt;10010&lt;/span&gt;&lt;/p&gt;&lt;/td&gt; &lt;td style="padding: 0cm 5.4pt; width: 48pt; height: 12.75pt;" nowrap="nowrap" valign="bottom" width="64"&gt; &lt;p class="ArticleText" style="text-align: right;" align="right"&gt;&lt;span&gt;99&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt; &lt;p class="ArticleText"&gt;Fig 3. Table holding student marks in Geography subject&lt;/p&gt;&lt;/div&gt; &lt;h2&gt;Interacting with Excel&lt;/h2&gt; &lt;p class="ArticleText"&gt;Fortunately, there are COM objects that are available to interact with the Excel file. Also, we can make use of the OleDB class to treat the Excel file as a simple table. In this way, we can fire SQL queries to the Excel file so that we can retrieve data from the sheets. An analogy can be made to a database. The Excel Workbook is considered as the Database while the Sheets are considered as tables. Microsoft Excel 11.0 Object Library should be added as Reference to get the features for interacting with Excel.&lt;/p&gt; &lt;div align="center"&gt; &lt;p class="ArticleText"&gt;&lt;img src="http://www.beansoftware.com/ASP.NET-Tutorials/Images/Excel-Reporting-Add-Reference.jpg" /&gt;&lt;br /&gt;Fig 4. Adding Microsoft Excel 11.0 Object Library as Reference&lt;/p&gt;&lt;/div&gt; &lt;p class="ArticleText"&gt;The Excel file is then added to the DataSource folder in ASAP.NET to be interacted with. To connect to a certain database, a connection string is needed. The same thing applies for Excel. The following is a key added in the Web.Config file for future reference.&lt;/p&gt; &lt;p class="ArticleText"&gt;&lt;span style="color: blue;"&gt;&lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;add&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;name&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;&lt;span&gt;"&lt;span style="color: blue;"&gt;ExcelConnection&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;connectionString&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;Provider=Microsoft.Jet.Oledb.4.0;Data Source=|DataDirectory|\SchoolMgt.xls;Extended Properties=Excel 8.0&lt;/span&gt;"&lt;span style="color: blue;"&gt;/&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="ArticleText"&gt;Note that our Excel file which contains the necessary data will be SchoolMgt.xls, as written in the connection string.&lt;/p&gt; &lt;div align="center"&gt; &lt;p class="ArticleText"&gt;&lt;img src="http://www.beansoftware.com/ASP.NET-Tutorials/Images/Excel-Reporting-Example.jpg" /&gt;&lt;br /&gt;Fig 5. Excel file illustrating Excel Book containing data sheets with data&lt;/p&gt;&lt;/div&gt; &lt;h2&gt;Reading data from Excel sheets&lt;/h2&gt; &lt;p class="ArticleText"&gt;Let us build an interface for getting data from the Excel file.&lt;/p&gt; &lt;div align="center"&gt; &lt;p class="ArticleText"&gt;&lt;img src="http://www.beansoftware.com/ASP.NET-Tutorials/Images/Excel-Reporting-Interface.jpg" /&gt;&lt;br /&gt;Fig 6. Interface to search records per table selected.&lt;/p&gt;&lt;/div&gt; &lt;p class="ArticleText"&gt;It is important to import the following:&lt;/p&gt; &lt;p class="ArticleText"&gt;&lt;span style="color: blue;"&gt;Imports&lt;/span&gt;&lt;span&gt; System.Data.OleDb&lt;/span&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;Imports&lt;/span&gt; System.Data&lt;/p&gt; &lt;p class="ArticleText"&gt;The following code creates the connection and builds the query based on the selected table.&lt;/p&gt; &lt;p class="ArticleText"&gt;&lt;span style="color: blue;"&gt;Protected&lt;/span&gt;&lt;span&gt; &lt;span style="color: blue;"&gt;Sub&lt;/span&gt; btnSearch_Click(&lt;span style="color: blue;"&gt;ByVal&lt;/span&gt; sender &lt;span style="color: blue;"&gt;As&lt;/span&gt; &lt;span style="color: blue;"&gt;Object&lt;/span&gt;, &lt;span style="color: blue;"&gt;ByVal&lt;/span&gt; e &lt;span style="color: blue;"&gt;As&lt;/span&gt; System.EventArgs) &lt;span style="color: blue;"&gt;Handles&lt;/span&gt; btnSearch.Click&lt;/span&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;Try&lt;/span&gt;&lt;br /&gt;&lt;span&gt;            &lt;span style="color: blue;"&gt;Dim&lt;/span&gt; strExcelConn &lt;span style="color: blue;"&gt;As&lt;/span&gt; &lt;span style="color: blue;"&gt;String&lt;/span&gt; = System.Configuration.ConfigurationManager.ConnectionStrings.Item(&lt;span style="color: maroon;"&gt;"ExcelConnection"&lt;/span&gt;).ToString()&lt;/span&gt;&lt;br /&gt;&lt;span&gt;            &lt;span style="color: blue;"&gt;Dim&lt;/span&gt; dbConn &lt;span style="color: blue;"&gt;As&lt;/span&gt; &lt;span style="color: blue;"&gt;New&lt;/span&gt; OleDbConnection(strExcelConn)&lt;/span&gt;&lt;br /&gt;&lt;span&gt;            &lt;span style="color: blue;"&gt;Dim&lt;/span&gt; strSQL &lt;span style="color: blue;"&gt;As&lt;/span&gt; &lt;span style="color: blue;"&gt;String&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span&gt;            strSQL = &lt;span style="color: maroon;"&gt;"SELECT * FROM ["&lt;/span&gt; &amp;amp; cmbSheets.SelectedItem.ToString() &amp;amp; &lt;span style="color: maroon;"&gt;"$]"&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: maroon;"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span&gt;            dbConn.Open()&lt;/span&gt;&lt;br /&gt;&lt;span&gt; &lt;/span&gt;&lt;br /&gt;&lt;span&gt;            &lt;span style="color: blue;"&gt;Dim&lt;/span&gt; cmd &lt;span style="color: blue;"&gt;As&lt;/span&gt; &lt;span style="color: blue;"&gt;New&lt;/span&gt; OleDbCommand(strSQL, dbConn)&lt;/span&gt;&lt;br /&gt;&lt;span&gt;            &lt;span style="color: blue;"&gt;Dim&lt;/span&gt; dsExcel &lt;span style="color: blue;"&gt;As&lt;/span&gt; &lt;span style="color: blue;"&gt;New&lt;/span&gt; DataSet&lt;/span&gt;&lt;br /&gt;&lt;span&gt;            &lt;span style="color: blue;"&gt;Dim&lt;/span&gt; daExcel &lt;span style="color: blue;"&gt;As&lt;/span&gt; &lt;span style="color: blue;"&gt;New&lt;/span&gt; OleDbDataAdapter(cmd)&lt;/span&gt;&lt;br /&gt;&lt;span&gt; &lt;/span&gt;&lt;br /&gt;&lt;span&gt;            daExcel.Fill(dsExcel)&lt;/span&gt;&lt;br /&gt;&lt;span&gt; &lt;/span&gt;&lt;br /&gt;&lt;span&gt;            dgResults.DataSource = dsExcel&lt;/span&gt;&lt;br /&gt;&lt;span&gt;            dgResults.DataBind()&lt;/span&gt;&lt;br /&gt;&lt;span&gt;        &lt;span style="color: blue;"&gt;Catch&lt;/span&gt; ex &lt;span style="color: blue;"&gt;As&lt;/span&gt; Exception&lt;/span&gt;&lt;br /&gt;&lt;span&gt;            &lt;span style="color: blue;"&gt;Throw&lt;/span&gt; ex&lt;/span&gt;&lt;br /&gt;&lt;span&gt;        &lt;span style="color: blue;"&gt;End&lt;/span&gt; &lt;span style="color: blue;"&gt;Try&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;End&lt;/span&gt;&lt;span&gt; &lt;span style="color: blue;"&gt;Sub&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="ArticleText"&gt;Please note that the table name in the SELECT query should be in the format [TableName$], which the square brackets and the dollar sign at the end.&lt;/p&gt; &lt;h2&gt;Playing with SELECT statements&lt;/h2&gt; &lt;p class="ArticleText"&gt;As you have guessed, the Excel file has turned out to be a normal database. The transparency that the OleDB connection had made is exceptional. Also, note that the first row is taken to contain field names for the columns.&lt;/p&gt; &lt;p class="ArticleText"&gt;Now, let us get the marks of the students in Mathematics, Geography and Total, sorted in Descending order.&lt;/p&gt; &lt;p class="ArticleText"&gt;&lt;span style="color: blue;"&gt;Protected&lt;/span&gt;&lt;span&gt; &lt;span style="color: blue;"&gt;Sub&lt;/span&gt; btnGenerateReport_Click(&lt;span style="color: blue;"&gt;ByVal&lt;/span&gt; sender &lt;span style="color: blue;"&gt;As&lt;/span&gt; &lt;span style="color: blue;"&gt;Object&lt;/span&gt;, &lt;span style="color: blue;"&gt;ByVal&lt;/span&gt; e &lt;span style="color: blue;"&gt;As&lt;/span&gt; System.EventArgs) &lt;span style="color: blue;"&gt;Handles&lt;/span&gt; btnGenerateReport.Click&lt;/span&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;Try&lt;/span&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;Dim&lt;/span&gt;&lt;span&gt; strExcelConn &lt;span style="color: blue;"&gt;As&lt;/span&gt; &lt;span style="color: blue;"&gt;String&lt;/span&gt; = System.Configuration.ConfigurationManager.ConnectionStrings.Item(&lt;span style="color: maroon;"&gt;"ExcelConnection"&lt;/span&gt;).ToString()&lt;/span&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;Dim&lt;/span&gt;&lt;span&gt; dbConn &lt;span style="color: blue;"&gt;As&lt;/span&gt; &lt;span style="color: blue;"&gt;New&lt;/span&gt; OleDbConnection(strExcelConn)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;Dim&lt;/span&gt;&lt;span&gt; strSQL &lt;span style="color: blue;"&gt;As&lt;/span&gt; &lt;span style="color: blue;"&gt;String&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span&gt;strSQL = &lt;span style="color: maroon;"&gt;"SELECT S.StudentId, S.StudentName, M.Marks, G.Marks, (M.Marks+G.Marks) AS Total "&lt;/span&gt;&amp;amp; _&lt;/span&gt;&lt;br /&gt;&lt;span&gt;                     &lt;span style="color: maroon;"&gt;"FROM [Students$] S, [Mathematics$] M, [Geography$] G "&lt;/span&gt;&amp;amp; _&lt;/span&gt;&lt;br /&gt;&lt;span&gt;                     &lt;span style="color: maroon;"&gt;"WHERE(S.StudentId = M.StudentId And S.StudentId = G.StudentId) "&lt;/span&gt; &amp;amp; _&lt;/span&gt;&lt;br /&gt;&lt;span&gt;                     &lt;span style="color: maroon;"&gt;"ORDER BY (M.Marks+G.Marks) DESC"&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;dbConn.Open()&lt;/span&gt;&lt;br /&gt;&lt;span&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;Dim&lt;/span&gt;&lt;span&gt; cmd &lt;span style="color: blue;"&gt;As&lt;/span&gt; &lt;span style="color: blue;"&gt;New&lt;/span&gt; OleDbCommand(strSQL, dbConn)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;Dim&lt;/span&gt;&lt;span&gt; dsExcel &lt;span style="color: blue;"&gt;As&lt;/span&gt; &lt;span style="color: blue;"&gt;New&lt;/span&gt; DataSet&lt;/span&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;Dim&lt;/span&gt;&lt;span&gt; daExcel &lt;span style="color: blue;"&gt;As&lt;/span&gt; &lt;span style="color: blue;"&gt;New&lt;/span&gt; OleDbDataAdapter(cmd)&lt;/span&gt;&lt;br /&gt;&lt;span&gt; &lt;/span&gt;&lt;br /&gt;&lt;span&gt;daExcel.Fill(dsExcel)&lt;/span&gt;&lt;br /&gt;&lt;span&gt; &lt;/span&gt;&lt;br /&gt;&lt;span&gt;dgReports.DataSource = dsExcel&lt;/span&gt;&lt;br /&gt;&lt;span&gt;dgReports.DataBind()&lt;/span&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;Catch&lt;/span&gt;&lt;span&gt; ex &lt;span style="color: blue;"&gt;As&lt;/span&gt; Exception&lt;/span&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;Throw&lt;/span&gt;&lt;span&gt; ex&lt;/span&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;End&lt;/span&gt;&lt;span&gt; &lt;span style="color: blue;"&gt;Try&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;End&lt;/span&gt;&lt;span&gt; &lt;span style="color: blue;"&gt;Sub&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;div align="center"&gt; &lt;p class="ArticleText"&gt;&lt;img src="http://www.beansoftware.com/ASP.NET-Tutorials/Images/Excel-Reporting-Generate.jpg" /&gt;&lt;br /&gt;Fig 7. Report generating the students' marks and total, sorted in descending order.&lt;/p&gt;&lt;/div&gt; &lt;h2&gt;Generating Excel Reports&lt;/h2&gt; &lt;p class="ArticleText"&gt;Two ways for generating Excel report will be discussed in this tutorial. The first one is using the "Response" class and the second one by manipulating the Excel objects that "Microsoft Excel 11.0" Objects provide.&lt;/p&gt; &lt;p class="ArticleText"&gt;The following piece of code illustrates how this is done&lt;/p&gt; &lt;p class="ArticleText"&gt;&lt;span&gt;    &lt;span style="color: blue;"&gt;Protected&lt;/span&gt; &lt;span style="color: blue;"&gt;Sub&lt;/span&gt; btnToExcelByResponse_Click(&lt;span style="color: blue;"&gt;ByVal&lt;/span&gt; sender &lt;span style="color: blue;"&gt;As&lt;/span&gt; &lt;span style="color: blue;"&gt;Object&lt;/span&gt;, &lt;span style="color: blue;"&gt;ByVal&lt;/span&gt; e &lt;span style="color: blue;"&gt;As&lt;/span&gt; System.EventArgs) &lt;span style="color: blue;"&gt;Handles&lt;/span&gt; btnToExcelByResponse.Click&lt;/span&gt;&lt;br /&gt;&lt;span&gt;        &lt;span style="color: green;"&gt;'   Variables declaration&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;        &lt;span style="color: blue;"&gt;Dim&lt;/span&gt; dsExport &lt;span style="color: blue;"&gt;As&lt;/span&gt; &lt;span style="color: blue;"&gt;New&lt;/span&gt; DataSet()&lt;/span&gt;&lt;br /&gt;&lt;span&gt;        &lt;span style="color: blue;"&gt;Dim&lt;/span&gt; tw &lt;span style="color: blue;"&gt;As&lt;/span&gt; &lt;span style="color: blue;"&gt;New&lt;/span&gt; System.IO.StringWriter()&lt;/span&gt;&lt;br /&gt;&lt;span&gt;        &lt;span style="color: blue;"&gt;Dim&lt;/span&gt; hw &lt;span style="color: blue;"&gt;As&lt;/span&gt; &lt;span style="color: blue;"&gt;New&lt;/span&gt; System.Web.UI.HtmlTextWriter(tw)&lt;/span&gt;&lt;br /&gt;&lt;span&gt;        &lt;span style="color: blue;"&gt;Dim&lt;/span&gt; dgGrid &lt;span style="color: blue;"&gt;As&lt;/span&gt; &lt;span style="color: blue;"&gt;New&lt;/span&gt; DataGrid()&lt;/span&gt;&lt;br /&gt;&lt;span&gt; &lt;/span&gt;&lt;br /&gt;&lt;span&gt;        dgGrid.DataSource = getData()&lt;/span&gt;&lt;br /&gt;&lt;span&gt; &lt;/span&gt;&lt;br /&gt;&lt;span&gt;        &lt;span style="color: green;"&gt;'   Report Header&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;        hw.WriteLine(&lt;span style="color: maroon;"&gt;"&lt;b&gt;&lt;u&gt;&lt;span style="font-size:'5';"&gt; Student Marking Report &lt;/span&gt;&lt;/u&gt;&lt;/b&gt;"&lt;/span&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span&gt; &lt;/span&gt;&lt;br /&gt;&lt;span&gt;        &lt;span style="color: green;"&gt;'   Get the HTML for the control.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;        dgGrid.HeaderStyle.Font.Bold = &lt;span style="color: blue;"&gt;True&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;        dgGrid.DataBind()&lt;/span&gt;&lt;br /&gt;&lt;span&gt;        dgGrid.RenderControl(hw)&lt;/span&gt;&lt;br /&gt;&lt;span&gt; &lt;/span&gt;&lt;br /&gt;&lt;span&gt;        &lt;span style="color: green;"&gt;'   Write the HTML back to the browser.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;        Response.ContentType = &lt;span style="color: maroon;"&gt;"application/vnd.ms-excel"&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;        &lt;span style="color: blue;"&gt;Me&lt;/span&gt;.EnableViewState = &lt;span style="color: blue;"&gt;False&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;        Response.Write(tw.ToString())&lt;/span&gt;&lt;br /&gt;&lt;span&gt;        Response.End()&lt;/span&gt;&lt;br /&gt;&lt;span&gt;    &lt;span style="color: blue;"&gt;End&lt;/span&gt; &lt;span style="color: blue;"&gt;Sub&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;ul type="circle"&gt;&lt;li&gt; &lt;p class="ArticleText"&gt;First, we create the dataset that will hold the records. Then, a StringWriter object (tw) is also created along with an HtmlTextWriter (hw) which takes as parameter the text writer object. They are important for rendering purposes; i.e. html tags can be applied like bold, italic etc. to the resulting Excel report.&lt;/p&gt; &lt;/li&gt;&lt;li&gt; &lt;p class="ArticleText"&gt;Also, a datagrid object which will store the dataset of records.&lt;/p&gt; &lt;/li&gt;&lt;li&gt; &lt;p class="ArticleText"&gt;Note that function getData() in the code snippet only contains the codes in the previous example which returns a dataset of records.&lt;/p&gt; &lt;/li&gt;&lt;li&gt; &lt;p class="ArticleText"&gt;hw.WriteLine(&lt;span style="color:#800000;"&gt;"&lt;b&gt;&lt;u&gt;&lt;span style="font-size:'5';"&gt; Student Marking Report &lt;/span&gt;&lt;/u&gt;&lt;/b&gt;"&lt;/span&gt;) shows that you can also combine HTML codes with the output for proper display. In our example, the font size will be 5, underlined and bold.&lt;/p&gt; &lt;/li&gt;&lt;li&gt; &lt;p class="ArticleText"&gt;dgGrid.RenderControl(hw) renders the HTML object with the data that the datagrid contains. The result is normally formatted in a tabular format.&lt;/p&gt; &lt;/li&gt;&lt;li&gt; &lt;p class="ArticleText"&gt;Response.ContentType = &lt;span style="color:#800000;"&gt;"application/vnd.ms-excel"&lt;/span&gt; makes the Reponse object output to Excel.&lt;/p&gt; &lt;/li&gt;&lt;li&gt; &lt;p class="ArticleText"&gt;Response.Write(tw.ToString()) outputs the formatted object to Excel.&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt; &lt;div align="center"&gt; &lt;p class="ArticleText"&gt;&lt;img src="http://www.beansoftware.com/ASP.NET-Tutorials/Images/Excel-Reporting-Output.jpg" /&gt;&lt;br /&gt;Figure 8. Output result showing the report that is generated in Excel&lt;/p&gt;&lt;/div&gt; &lt;p class="ArticleText"&gt;The second way for generating Excel reports from ASP.NET is to use the Microsoft Excel 11.0 Objects. This method offers more fallibility in terms of manipulating the features that Excel provides and formatting the report.&lt;/p&gt; &lt;p class="ArticleText"&gt;The following code snippet makes use of the various Excel objects that Excel provides to generate the report.&lt;/p&gt; &lt;p class="ArticleText"&gt;&lt;span style="color: blue;"&gt;Imports&lt;/span&gt;&lt;span&gt; System.Reflection&lt;/span&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;Imports&lt;/span&gt;&lt;span&gt; Excel = Microsoft.Office.Interop.Excel&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: 10pt;"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span&gt;    &lt;span style="color: blue;"&gt;Protected&lt;/span&gt; &lt;span style="color: blue;"&gt;Sub&lt;/span&gt; btnToExcelByObjects_Click(&lt;span style="color: blue;"&gt;ByVal&lt;/span&gt; sender &lt;span style="color: blue;"&gt;As&lt;/span&gt; &lt;span style="color: blue;"&gt;Object&lt;/span&gt;, &lt;span style="color: blue;"&gt;ByVal&lt;/span&gt; e &lt;span style="color: blue;"&gt;As&lt;/span&gt; System.EventArgs) &lt;span style="color: blue;"&gt;Handles&lt;/span&gt; btnToExcelByObjects.Click&lt;/span&gt;&lt;br /&gt;&lt;span&gt;        &lt;span style="color: blue;"&gt;Try&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;            &lt;span style="color: blue;"&gt;Dim&lt;/span&gt; xlWorkBook &lt;span style="color: blue;"&gt;As&lt;/span&gt; Excel.Workbook&lt;/span&gt;&lt;br /&gt;&lt;span&gt;            &lt;span style="color: blue;"&gt;Dim&lt;/span&gt; xlWorkSheet &lt;span style="color: blue;"&gt;As&lt;/span&gt; Excel.Worksheet&lt;/span&gt;&lt;br /&gt;&lt;span&gt; &lt;/span&gt;&lt;br /&gt;&lt;span&gt;            xlWorkBook = &lt;span style="color: blue;"&gt;New&lt;/span&gt; Excel.Application().Workbooks.Add(Missing.Value)&lt;/span&gt;&lt;br /&gt;&lt;span&gt;            xlWorkBook.Application.Visible = &lt;span style="color: blue;"&gt;True&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;            xlWorkSheet = xlWorkBook.ActiveSheet&lt;/span&gt;&lt;br /&gt;&lt;span&gt; &lt;/span&gt;&lt;br /&gt;&lt;span&gt;            &lt;span style="color: green;"&gt;'   Gets the dataset containing the data&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;            &lt;span style="color: blue;"&gt;Dim&lt;/span&gt; dsData &lt;span style="color: blue;"&gt;As&lt;/span&gt; DataSet = getData()&lt;/span&gt;&lt;br /&gt;&lt;span&gt;            &lt;span style="color: blue;"&gt;Dim&lt;/span&gt; i &lt;span style="color: blue;"&gt;As&lt;/span&gt; &lt;span style="color: blue;"&gt;Integer&lt;/span&gt; = 2&lt;/span&gt;&lt;br /&gt;&lt;span&gt; &lt;/span&gt;&lt;br /&gt;&lt;span&gt;            &lt;span style="color: green;"&gt;'   Outputting the fieldnames in pink bold color&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;            xlWorkSheet.Cells(1, 1) = &lt;span style="color: maroon;"&gt;"Student ID"&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;            xlWorkSheet.Cells(1, 2) = &lt;span style="color: maroon;"&gt;"Student Name"&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;            xlWorkSheet.Cells(1, 3) = &lt;span style="color: maroon;"&gt;"Mathematics"&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;            xlWorkSheet.Cells(1, 4) = &lt;span style="color: maroon;"&gt;"Geography"&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;            xlWorkSheet.Cells(1, 5) = &lt;span style="color: maroon;"&gt;"Total"&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: maroon;"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span&gt;            xlWorkSheet.Range(&lt;span style="color: maroon;"&gt;"$A1:$E1"&lt;/span&gt;).Font.ColorIndex = Excel.Constants.xlColor1&lt;/span&gt;&lt;br /&gt;&lt;span&gt;            xlWorkSheet.Range(&lt;span style="color: maroon;"&gt;"$A1:$E1"&lt;/span&gt;).Font.Bold = &lt;span style="color: blue;"&gt;True&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span&gt;            &lt;span style="color: green;"&gt;'   Outputting the data&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;            &lt;span style="color: blue;"&gt;For&lt;/span&gt; &lt;span style="color: blue;"&gt;Each&lt;/span&gt; dr &lt;span style="color: blue;"&gt;As&lt;/span&gt; DataRow &lt;span style="color: blue;"&gt;In&lt;/span&gt; dsData.Tables(0).Rows&lt;/span&gt;&lt;br /&gt;&lt;span&gt;                xlWorkSheet.Cells(i, 1) = dr(0)&lt;/span&gt;&lt;br /&gt;&lt;span&gt;                xlWorkSheet.Cells(i, 2) = dr(1)&lt;/span&gt;&lt;br /&gt;&lt;span&gt;                xlWorkSheet.Cells(i, 3) = dr(2)&lt;/span&gt;&lt;br /&gt;&lt;span&gt;                xlWorkSheet.Cells(i, 4) = dr(3)&lt;/span&gt;&lt;br /&gt;&lt;span&gt; &lt;/span&gt;&lt;br /&gt;&lt;span&gt;                &lt;span style="color: green;"&gt;'   Building the formula for calculating the sum&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;                xlWorkSheet.Cells(i, 5).Formula = &lt;span style="color: maroon;"&gt;"=SUM($C{0}:$D{0})"&lt;/span&gt;.Replace(&lt;span style="color: maroon;"&gt;"{0}"&lt;/span&gt;, i.ToString())&lt;/span&gt;&lt;br /&gt;&lt;span&gt; &lt;/span&gt;&lt;br /&gt;&lt;span&gt;                &lt;span style="color: green;"&gt;'   Going to the next row&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;                i = i + 1&lt;/span&gt;&lt;br /&gt;&lt;span&gt;            &lt;span style="color: blue;"&gt;Next&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span&gt;            &lt;span style="color: green;"&gt;'   Auto fit the columns&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;            xlWorkSheet.Columns.AutoFit()&lt;/span&gt;&lt;br /&gt;&lt;span&gt; &lt;/span&gt;&lt;br /&gt;&lt;span&gt;            &lt;span style="color: green;"&gt;'   Generating the graph&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;            &lt;span style="color: blue;"&gt;Dim&lt;/span&gt; chart &lt;span style="color: blue;"&gt;As&lt;/span&gt; Excel.Chart&lt;/span&gt;&lt;br /&gt;&lt;span&gt;            chart = xlWorkBook.Charts.Add()&lt;/span&gt;&lt;br /&gt;&lt;span&gt; &lt;/span&gt;&lt;br /&gt;&lt;span&gt;            &lt;span style="color: blue;"&gt;With&lt;/span&gt; chart&lt;/span&gt;&lt;br /&gt;&lt;span&gt;                .ChartType = Excel.XlChartType.xlColumnClustered&lt;/span&gt;&lt;br /&gt;&lt;span&gt;                .SetSourceData(xlWorkSheet.Range(&lt;span style="color: maroon;"&gt;"A1:E11"&lt;/span&gt;), 2)&lt;/span&gt;&lt;br /&gt;&lt;span&gt; &lt;/span&gt;&lt;br /&gt;&lt;span&gt;                .HasTitle = &lt;span style="color: blue;"&gt;True&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;                .ChartTitle.Characters.Text = &lt;span style="color: maroon;"&gt;"Students' marks"&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: maroon;"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span&gt;                .Axes(1, Excel.XlAxisGroup.xlPrimary).HasTitle = &lt;span style="color: blue;"&gt;True&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;                .Axes(1, Excel.XlAxisGroup.xlPrimary).AxisTitle.Characters.Text = &lt;span style="color: maroon;"&gt;"Students"&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;                .Axes(2, Excel.XlAxisGroup.xlPrimary).HasTitle = &lt;span style="color: blue;"&gt;True&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;                .Axes(2, Excel.XlAxisGroup.xlPrimary).AxisTitle.Characters.Text = &lt;span style="color: maroon;"&gt;"Marks"&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;            &lt;span style="color: blue;"&gt;End&lt;/span&gt; &lt;span style="color: blue;"&gt;With&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;        &lt;span style="color: blue;"&gt;Catch&lt;/span&gt; ex &lt;span style="color: blue;"&gt;As&lt;/span&gt; Exception&lt;/span&gt;&lt;br /&gt;&lt;span&gt;            &lt;span style="color: blue;"&gt;Throw&lt;/span&gt; ex&lt;/span&gt;&lt;br /&gt;&lt;span&gt;        &lt;span style="color: blue;"&gt;End&lt;/span&gt; &lt;span style="color: blue;"&gt;Try&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;    &lt;span style="color: blue;"&gt;End&lt;/span&gt; &lt;span style="color: blue;"&gt;Sub&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="ArticleText"&gt;An Excel workbook is first created. Then the active sheet is accessed by xlWorkSheet = xlWorkBook.ActiveSheet. After that, we get the data into the dataset, ready to be processed. Using the Font property, the title is displayed in Pink bold colour. Note how the Formula that Excel provides is properly used to calculate the SUM of the marks for each student xlWorkSheet.Cells(i, 5).Formula = "=SUM($C{0}:$D{0})".Replace("{0}", i.ToString()). &lt;/p&gt; &lt;div align="center"&gt; &lt;p class="ArticleText"&gt;&lt;img src="http://www.beansoftware.com/ASP.NET-Tutorials/Images/Excel-Reporting-Output-Marked.jpg" /&gt;&lt;br /&gt;Figure 9. Excel Report having output the list of students and their respective marks.&lt;/p&gt;&lt;/div&gt; &lt;p class="ArticleText"&gt;A chart is also generated using the objects. The x-axis consists of the names and id of each student. The y-axis, the marks for the different students. The chart is always handy for analysis of data.&lt;/p&gt;  &lt;img src="http://www.beansoftware.com/ASP.NET-Tutorials/Images/Excel-Reporting-Chart.jpg" /&gt;&lt;br /&gt;Figure 10. Chart that is generated using Microsoft Excel 11.0 Objects&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4926429223536207631-8536681709837498492?l=sudag.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudag.blogspot.com/feeds/8536681709837498492/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4926429223536207631&amp;postID=8536681709837498492' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/8536681709837498492'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/8536681709837498492'/><link rel='alternate' type='text/html' href='http://sudag.blogspot.com/2008/08/excel-reports-in-aspnet-20.html' title='Excel Reports in ASP.NET 2.0'/><author><name>suda</name><uri>http://www.blogger.com/profile/15635297681991446902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4926429223536207631.post-7901275898477689806</id><published>2008-08-26T00:54:00.000-07:00</published><updated>2008-08-26T00:55:31.000-07:00</updated><title type='text'>Open and Edit Cells in an Excel 2007 file in VB.NET</title><content type='html'>&lt;span style="color: rgb(153, 0, 0);"&gt;http://vb.net-informations.com/excel-2007/vb.net_excel_2007_open_file.htm&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4926429223536207631-7901275898477689806?l=sudag.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudag.blogspot.com/feeds/7901275898477689806/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4926429223536207631&amp;postID=7901275898477689806' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/7901275898477689806'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/7901275898477689806'/><link rel='alternate' type='text/html' href='http://sudag.blogspot.com/2008/08/open-and-edit-cells-in-excel-2007-file.html' title='Open and Edit Cells in an Excel 2007 file in VB.NET'/><author><name>suda</name><uri>http://www.blogger.com/profile/15635297681991446902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4926429223536207631.post-3138917174582831707</id><published>2008-08-26T00:53:00.000-07:00</published><updated>2008-08-26T00:54:31.461-07:00</updated><title type='text'>Open an Excel File in .net</title><content type='html'>&lt;span style="color: rgb(153, 0, 0);"&gt; Dim xlApp As Microsoft.Office.Interop.Excel.Application&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;                    Dim xlWorkBook As Microsoft.Office.Interop.Excel.Workbook&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;                    Dim xlWorkSheet As Microsoft.Office.Interop.Excel.Worksheet&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;                    xlApp = New Microsoft.Office.Interop.Excel.ApplicationClass&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;                    xlWorkBook = xlApp.Workbooks.Open(strpath)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;                    xlWorkSheet = xlWorkBook.Worksheets("sheet1")&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;                    xlWorkBook.Application.Visible = True&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4926429223536207631-3138917174582831707?l=sudag.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudag.blogspot.com/feeds/3138917174582831707/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4926429223536207631&amp;postID=3138917174582831707' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/3138917174582831707'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/3138917174582831707'/><link rel='alternate' type='text/html' href='http://sudag.blogspot.com/2008/08/open-excel-file-in-net.html' title='Open an Excel File in .net'/><author><name>suda</name><uri>http://www.blogger.com/profile/15635297681991446902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4926429223536207631.post-3586702562596568828</id><published>2008-08-21T00:56:00.000-07:00</published><updated>2008-08-21T00:57:30.327-07:00</updated><title type='text'>Sub reports in crystal reports</title><content type='html'>http://aspalliance.com/1673_Creating_SubReports_Using_Crystal_Reports.all&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4926429223536207631-3586702562596568828?l=sudag.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudag.blogspot.com/feeds/3586702562596568828/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4926429223536207631&amp;postID=3586702562596568828' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/3586702562596568828'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/3586702562596568828'/><link rel='alternate' type='text/html' href='http://sudag.blogspot.com/2008/08/sub-reports-in-crystal-reports.html' title='Sub reports in crystal reports'/><author><name>suda</name><uri>http://www.blogger.com/profile/15635297681991446902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4926429223536207631.post-7495326743068189607</id><published>2008-08-08T01:03:00.000-07:00</published><updated>2008-10-14T02:01:52.046-07:00</updated><title type='text'>Removing duplicate records from datatable in ADO.NET</title><content type='html'>private DataTable RemoveDuplicates(DataTable dt)&lt;br /&gt;        {&lt;br /&gt;            DataTable dtUnique = new DataTable();&lt;br /&gt;            dtUnique = dt.Clone();&lt;br /&gt;            DataColumn[] coln = new DataColumn[dt.Columns.Count];&lt;br /&gt;            dtUnique.Columns.CopyTo(coln, 0);&lt;br /&gt;            dtUnique.PrimaryKey = coln;&lt;br /&gt;            DataRow[] drs = new DataRow[dt.Rows.Count];&lt;br /&gt;            dt.Rows.CopyTo(drs, 0);&lt;br /&gt;&lt;br /&gt;            foreach (DataRow dr1 in drs)&lt;br /&gt;            {&lt;br /&gt;                if (dtUnique.Rows.Contains(dr1.ItemArray))&lt;br /&gt;                    dt.Rows.Remove(dr1);&lt;br /&gt;                else&lt;br /&gt;                    dtUnique.Rows.Add(dr1.ItemArray);&lt;br /&gt;            }&lt;br /&gt;            dt.Dispose();&lt;br /&gt;            drs = null;&lt;br /&gt;            coln = null;&lt;br /&gt;&lt;br /&gt;            return dtUnique;&lt;br /&gt;        }&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4926429223536207631-7495326743068189607?l=sudag.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sudag.blogspot.com/feeds/7495326743068189607/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4926429223536207631&amp;postID=7495326743068189607' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/7495326743068189607'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4926429223536207631/posts/default/7495326743068189607'/><link rel='alternate' type='text/html' href='http://sudag.blogspot.com/2008/08/removing-duplicate-records-from.html' title='Removing duplicate records from datatable in ADO.NET'/><author><name>suda</name><uri>http://www.blogger.com/profile/15635297681991446902</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4926429223536207631.post-2554298314522226471</id><published>2008-08-06T02:37:00.000-07:00</published><updated>2008-08-06T02:39:59.136-07:00</updated><title type='text'>Exporting PDF format type crystal reports to disk file in vb.net 2.0</title><content type='html'>&lt;span style="color: rgb(153, 51, 0);"&gt;Public Sub ReportDocumentDetails(ByVal rptPath As String, ByVal reportname As String, ByVal dtReport As DataTable, _&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 51, 0);"&gt;                                    ByVal arListName As System.Collections.ArrayList, ByVal arListValue As System.Collections.ArrayList)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 51, 0);"&gt;        Dim rptViewer As New CrystalDecisions.Windows.Forms.CrystalReportViewer()&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 51, 0);"&gt;        Dim ds As DatasetReport = New DatasetReport&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 51, 0);"&gt;     &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 51, 0);"&gt;        &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 51, 0);"&gt;        Dim rptdoc As CrystalDecisions.CrystalReports.Engine.ReportDocument = New CrystalDecisions.CrystalReports.Engine.ReportDocument&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 51, 0);"&gt;        rptdoc.Load(rptPath)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 51, 0);"&gt;        rptdoc.SetDataSource(CType(dtReport, DataTable))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 51, 0);"&gt;        If (arListName.Count = arListValue.Count) Then&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 51, 0);"&gt;            For i As Integer = 0 To arListName.Count - 1&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 51, 0);"&gt;                rptdoc.SetParameterValue(arListName(i).ToString, arListValue(i))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 51, 0);"&gt;            Next&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 51, 0);"&gt;        End If&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 51, 0);"&gt;      &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 51, 0);"&gt;        Dim objExOpt As CrystalDecisions.Sha
