Tips & Tricks

142 posts

ASP.NET LinkButton background image with CSS

Here is the style: .LinkButton {   background:url(“imagePath/imageFile.gif”) top left no-repeat;   display:block;  /* Image will not show up without this line   width:32px;  /* change to the actual image width */   height: 32px;  /* change to the actual image height */ } How to use it? Define the LinkButton as follows: <asp:LinkButton ID=”LinkButton1″ runat=”server CssClass=”LinkButton”></asp:LinkButton> To add a hover effect, for example, changing the background image when hovering the mouse over the LinkButton. […]

Error when executing a .vsi installer

You may receive this error when installing a template with .vsi installer, such as AJAXToolkitExtender installer: Installation stopped because the directory for the ProjectType value did not exist. The project type is invalid for your installation of Visual Studio. The cause is the missing of the specific template folder for each language under “C:\Documents and Settings\xxxxx\My Documents\Visual Studio 2005\Templates\ProjectTemplates\”. For VB.NET, manually create a folder named “Visual Basic”; for C#, manually create a folder named […]

Unable to start debugging on the web server

Is this error familiar to you? Error while trying to run project: Unable to start debugging on the web server.  Click Help for more information.       When you click Help button, you get a Topic Not Found page. It is caused by the wrong ASP.NET version the project runs under. It is very common if you have Visual Studio 2003 and 2005 on your machine, then .NET 2.0 will be the targeted by […]

CheckBoxList and Tooltip

The built-in Tooltip for the CheckBoxList control displays information for the whole CheckBoxList, but what if I want to have a tooltip for each listitem in the CheckBoxList? The ListItem has a very nice property called “Title” which can be used to generate a “tooltip” effect. Here is the code snippet: VB.NET Private Sub CheckBoxList1_DataBound(ByVal sender As Object, _                 ByVal e As System.EventArgs) Handles CheckBoxList1.DataBound     […]

IErrorInfo.GetDescription Failed with E_FAIL(0x80004005)

When you run a SELECT query in your ASP.NET code to fill a DataSet, you may encounter this error: IErrorInfo.GetDescription Failed with E_FAIL(0x80004005) This error is usually caused by the fact that the table name or some column name happens to be a keyword, such as “name”, “first”, and “date”, etc. If it is the case, then use square brackets around those column names as [name], [first], and [date], and it should fix the error.

How to disable the X button on a Windows Form?

How can you disable the “X” button on a Windows Form so that user has to click a Close button on the form to close the window? You may say just set ControlBox=False for the Form. But it will hide all the buttons, including the minimize and the maximize button. What if you still want user to be able to minimize/maximize the window? Jose Luis Manners described a very simple but slick way to accomplish […]

“Setup cannot copy the file staxmem.dll” error when installing IIS on XP

When I tried to install IIS on my laptop which is running Windows XP Pro SP2, I got this error during the installtion: “Copy error Setup cannot copy the file staxmem.dl_. Ensure that the disk labeled ‘Windows XP Professional Service pack 2 CD’ is in the drive selected below, or provide the location where the file can be found.” After some search on the Internet, it turned out it is a very common error that […]

It is an error to use a section registered as allowDefinition=’MachineToApplication’ beyond application level

When launching a web application, an error like this shows up: It is an error to use a section registered as allowDefinition=’MachineToApplication’ beyond application level.  This error can be caused by a virtual directory not being configured as an application in IIS. There are several causes for this error: 1. Just like the error says, the virtual directory in IIS is not an application folder. To fix, just go to IIS and expand “Default Website” […]

Generate Random Text in Word 2007

A very handy tip I got via email from Microsoft. On a blank line in a Microsoft Office Word document, type =rand followed by (PC,SC)—where PC stands for paragraph count and SC stands for sentence count—and then press ENTER. For example, =rand(2,3) will create two paragraphs of three sentences each. Word inserts some random text based on your specification. You can use this new text for testing form controls such as text boxes or paragraph […]

Prevent browser from remembering inputted data in text box

Browser has a handy feature that remembers the information entered earlier in text boxes, and this feature can save you a lot of time when you fill up a form on-line. Sometimes, however, this feature may cause unwanted behaviors, even security concerns. For example, browser should not remember the credit card number that was entered. Another example is if you have a RegularExpressionValidator to validate a text box field, and if the text box has […]