How To Fix Archives - Page 11 of 12 - Digital Tool Factory blog How To Fix Archives - Page 11 of 12 - Digital Tool Factory blog

The Digital Tool Factory Blog

How to fix the Microsoft.Web.Administration.dll problem

The Problem: While coding away on the Stronico signup process I came across a problem with creating a reference to the Microsoft.Web.Administration dll, namely it was not present as a reference.  No problem, I added the dll manually via Visual Studio (it is in the %WinDir%System32InetSrv directory), yet once that was done I could not reference the dll.

The Cause: The dll must be marked as “Copy Local – True” and “Specific Version – True”.

The Solution: Mark the two options as true in the properties and the problem will go away.  It’s always the stupid errors that cause the most problems.  One of the purposes of blogging these errors is to  reduce their frequency.

 

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


24
Jan 10


Written By Steve French

 

How to fix the color shift in PhotoShop CS 4 Save for Web

The Problem: You have a lovely graphic, you save it for the web in the standard way, and the colors are way, way off.  Usually there is extra purple.  You scour the web and alter setting after setting in PhotoShop, all to no avail.

The Cause: It’s not Photoshop problem.  For whatever reason the default image previewer uses different color settings than Adobe Photoshop, and this results in a different looking image.

The Solution: Just ignore it.  The colors are only different in the preview, not in the final product.

 

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


15
Jan 10


Written By Steve French

 

How to set up the CheckBoxList control in Asp.net

I recently came up with the need to have a validated CheckBoxList in and Asp.net page.  Over the years I’ve come up with a standard way of setting up validated CheckBoxLists, so I thought I would share the method and start the brand new “Code Samples” section..

The aspx code is as follows

<strong>Section Name</strong>
<asp:TextBox ID="tbBox" runat="server" Width="1" BorderColor="White" BackColor="White" BorderStyle="None" />
<asp:CustomValidator ID="cvBox" ValidateEmptyText="true" runat="server" ControlToValidate="tbBox" Display="none" ErrorMessage="<b>Required Field Missing</b><br />You must select at least one option" SetFocusOnError="true" ValidationGroup="Main" onservervalidate="cvBox_ServerValidate" />
<ajaxToolkit:ValidatorCalloutExtender ID="vceBox" runat="server" TargetControlID="cvBox" Width="300" />

<br />

<asp:CheckBoxList ID=”cblForms” runat=”server” RepeatColumns=”2″ RepeatDirection=”Horizontal”>
<asp:ListItem Text=”Option A” Value=”A” />
<asp:ListItem Text=”Option B” Value=”B” />
<asp:ListItem Text=”Option C” Value=”C” />
<asp:ListItem Text=”Option D” Value=”D” />
</asp:CheckBoxList>

Please note, the control that I am validating is actually a 1 pixel wide textbox that one should not type in. Continue reading →


14
Jan 10


Written By Steve French

 

How to fix “The entry ‘ScriptModule’ has already been added.” error

The Problem: The web application works just fine on the local machine, but when you upload it to the web server you get the error “The entry ‘ScriptModule’ has already been added.”

The Cause: It is a conflict between asp.net versions.

The Solution: Simply comment out the <add name=”ScriptModule” type=”System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35″/> line in the web.config file and you should be good to go.

 

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


23
Dec 09


Written By Steve French

 

How to create a fully validated asp.net calendar control

The Problem: You have to have a fully validated date box. The dates must be valid dates and there must be data entered in the field.

The Cause: Not a problem really, I wind up rewriting it slightly differently each time. I thought I would put a definitive version here.

The Solution: Use this code
<asp:TextBox ID=”tbDate” runat=”server” CssClass=”body” />
<ajaxToolkit:MaskedEditExtender ID=”meeDate” runat=”server”
TargetControlID=”tbDate”
Mask=”99/99/9999″
MessageValidatorTip=”true”
OnFocusCssClass=”MaskedEditFocus”
OnInvalidCssClass=”MaskedEditError”
MaskType=”Date”
DisplayMoney=”Left”
AcceptNegative=”Left”
ErrorTooltipEnabled=”True” />
<ajaxToolkit:CalendarExtender ID=”ceDate” runat=”server” TargetControlID=”tbDate” PopupButtonID=”imgDate” />
<asp:RequiredFieldValidator ID=”rfvDate” runat=”server” ControlToValidate=”tbDate”
Display=”none” ErrorMessage=”<b>Required Field Missing</b><br />You must supply a date”
SetFocusOnError=”true” ValidationGroup=”MainB” />
<ajaxToolkit:ValidatorCalloutExtender ID=”vceDate” runat=”server” TargetControlID=”rfvDate” Width=”300″ />

<asp:CompareValidator ID=”compVDate” runat=”server” ValidationGroup=”MainB”
ControlToValidate=”tbDate” Display=”None” ErrorMessage=”<b>Required Field Missing</b><br />You must supply a valid date”
Operator=”DataTypeCheck” Type=”Date” />
<ajaxToolkit:ValidatorCalloutExtender ID=”vceCompDate” runat=”server” TargetControlID=”compVDate” Width=”300″ />
<asp:ImageButton runat=”Server” ID=”imgDate” ImageUrl=”img/icon_calendar.gif” AlternateText=”Click to show calendar” />

That’s it!

 

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


17
Dec 09


Written By Steve French

 

How to fix problem with intellisense in Visual Studio 2008

The Problem: For whatever reason Intelliense in Visual Studio shows up for standard asp.net web controls appears on some pages and not on others.

The Cause: Visual Studio is a tricky little program, I have no idea why this happened. I went though the web.config files, encoding, rebooted and still got no resolution.

The Solution: Recreate the master page for the web form pages where the error occurs, then change the master page on those pages to the new master page. For whatever reason this works well. All told, it took me 45 minutes to get the problem resolved.

 

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


16
Dec 09


Written By Steve French

 

How to fix the Adobe Acrobat “Save As” error

The Problem: You attempt to save a dynamically generated pdf built from a website and get the error “The document could not be saved, a number is out of range”

The Cause: Incompatibility of settings between the version of Acrobat that created the pdf and the version of Acrobat that is being used to view the pdf

The Solution: Go to preferences, go to “General” and uncheck “Save As optimizes for Fast Web View” and see if that fixes the problem. HT Planet PDF for the tip.

 

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


14
Dec 09


Written By Steve French

 

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

 




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