December 2009 - Page 2 of 2 - Digital Tool Factory blog December 2009 - Page 2 of 2 - Digital Tool Factory blog

The Digital Tool Factory Blog

How to programmatically create an Excel Spreadsheet in ASP.net/ C#

The Problem: You need to create a dynamic excel spreadsheet in C#/ASP.net. There are several ways to accomplish this, but this is one I use when I don’t need to specify the column names order to any great detail. I’ve included it in the How To Fix series simply because it took me more than 15 minutes to find the code, and rules are rules.

The Cause: No cause really, this is a method. The cause of hte problem was being a bit disorganized today.

The Solution: Just copy and paste the following code into your C# code behind and let her rip! Utility.dsGrab is just a function that returns a dataset.

DataTable dt = new DataTable();DataSet ds = Utility.dsGrab("SampleDataSet");dt = ds.Tables[0];GridView gv = new GridView();

if (dt.Rows.Count > 0){gv.DataSource = dt;gv.DataBind();System.IO.StringWriter oStringWriter =     new System.IO.StringWriter();System.Web.UI.HtmlTextWriter oHtmlTextWriter =     new HtmlTextWriter(oStringWriter);Response.ClearContent();Response.ContentType = "application/ms-excel";Response.AddHeader("Content-Disposition", "attachment;     filename=SampleExcel.xls");Response.Charset = "";Response.Buffer = true;EnableViewState = false;gv.RenderControl(oHtmlTextWriter);Response.Write(oStringWriter.ToString());Response.End();}

That’s it! It won’t open up in the browser window either.

 

This post originally appeared on the Stronico blog – with the absorption of Stronico into Digital Tool Factory this post has been moved to the Digital Tool Factory blog


09
Dec 09


Written By Steve French

 

How to fix problems with SSL certs in Plesk

The Problem: You attempt to install (or renew) an SSL certificate in Plesk (web hosting management software) but when you follow the instructions (meaning add the certificate in Plesk, and then going to the “Setup” screen for the domain, you do not have the option of selecting the renewed certificate.

The Cause: This is the first domain that was created and an SSL cert was immediately added, then other domains were added via Plesk. Plesk no longer sees this domain as having a valid IP address it can use. There is no way to change this in Plesk.

The Solution: Bypass Plesk and install directly in IIS – go to this link on installing an SSL cert and follow the directions very carefully.

 

This post originally appeared on the Stronico blog – with the absorption of Stronico into Digital Tool Factory this post has been moved to the Digital Tool Factory blog


07
Dec 09


Written By Steve French

 

How to fix invisible view in ASP.net mvc

This is not the most significant I know, but the goal is to document every problem that took more than 15 minutes to solve, and I did try the more complicated methods before I tried the obvious one, so here it is.

The Problem: When programming in ASP.net MVC in Visual Studio 2008 you create a new folder, in the views directory, then create a new view in that directory called Index. For example I was working on the Stronico public site (coming soon, really) and created a directory called “Contact”, and a view called “Index.aspx” so the url could be http://www.Stronico.com/Contact/. I also created the Controller “ContactController.cs”. When I went to the staging site on LocalHost, I got the “File Not Found” error.

The Cause: I never did find out. I tried changing the verbiage slightly, in case contact was a protected word, I reset IIS, I did several other things. None of the usual methods worked.

The Solution: I finally just closed the solution and restarted it and I was able to get to the contact page. No idea why that worked, but it did.

Sort of a a lame post, but I did spend slightly more than fifteen minutes trying to see why the page would not appear, only to find it to be a simple Visual Studio error.

 

This post originally appeared on the Stronico blog – with the absorption of Stronico into Digital Tool Factory this post has been moved to the Digital Tool Factory blog


05
Dec 09


Written By Steve French

 

How to fix Quickbooks 2010 printing problem on 64 Bit Windows, (Error Code -30)

I intended the focus of the “How To Fix” posts to be Silverlight, but as I’ve encountered other problems while setting up the business, I’m posting those. The rule I established is “If it takes more than 15 minutes to fix, it gets documented” so here we go.

The Problem: You finally get Quickbooks 2010 installed and your old data migrated, and you get the “Printer not activated, error code -30” error window when sending an invoice, pictured below.

and

If you Google the error messages you will see that there are many, many reasons this error can occur.

The Cause: In my case, this was due to running Vista Ultimate 64 Bit. I assume it is the same on Windows 7 64 Bit or Vista Business 64 Bit. The cause is the pdf driver for Quickbooks not working with 64 bit Windows.

The Solution: You go to this QuickBooks help page and change a large number of properties. Why? Who knows, but that solved the problem for me. Intuit did not include any warnings about 32 vs 64 bit differences in their program, to their shame.

 

This post originally appeared on the Stronico blog – with the absorption of Stronico into Digital Tool Factory this post has been moved to the Digital Tool Factory blog


03
Dec 09


Written By Steve French

 

Quick review of RescueTime

Yesterday I downloaded and installed RescueTime – So far I like it. It hasn’t had that much time to gather data but it does identify many weak ponts. A longer review will be coming as soon as there is more to work with.

 

This post originally appeared on the Stronico blog – with the absorption of Stronico into Digital Tool Factory this post has been moved to the Digital Tool Factory blog


03
Dec 09


Written By Steve French

 

At long last QuickBooks will work

After recreating an XP 32bit Pro installation on two different drives, I finally get QuickBooks 2010 to work on my machine. Now to actually use it and see if it is the fun everyone tells me it is.

 

This post originally appeared on the Stronico blog – with the absorption of Stronico into Digital Tool Factory this post has been moved to the Digital Tool Factory blog


01
Dec 09


Written By Steve French

 




Copyright 2011 Digital Tool Factory. All Rights Reserved. Powered by raw technical talent. And in this case, WordPress.