Tips & Tricks

146 posts

Add days, months and years in JavaScript

This JavaScript function has been updated to better handle various scenarios, please check the new version here: https://learningpenguin.net/2017/07/20/add-days-months-years-date-javascript/ In ASP.NET, you can easily use DateTime.AddDays(), DateTime.AddMonths(), or DateTime.AddyYears() function to get a new DateTime object, but in JavaScript, there is no such built-in function. Since it is very common you have to do some date calculation or validation in JavaScript, I decided to write my own JavaScript function to add days, months, and years to a […]

How to add Google plus button to your WordPress blog

In this post, I will show you how to add Google +1 button to your WordPress blog, but my tutorial involves modifying some theme files, so it depends on the theme you use. If you use a different theme, this tutorial still should give you some ideas which theme function to modify. My current theme is Admired Theme, so I will show you how to add Google +1 button to this theme after the blog […]

Add winter touch to your web site

Since it is December and I am in the northern part, I figure it is time to add a little winter touch to my web site, so I added some snow flakes flying down on my web site. Have you noticed it (well, the snow only comes in December, and keep reading to find out why)? If you want to know how to do it on your web site, here is how. 1. Go to […]

How to Remove Windows Active Guard

Windows Active Guard is a very cunning and nasty computer virus and spyware which displays various fake security alerts and warnings after fake system scan, for example reporting some malware/spyware found in your computer, to lure the user to purchase Windows Active Guard in order to remove the detected threats. However, purchasing Windows Active Guard not only has wasted your money, but also has given the virus an opportunity to steal your sensitive financial information […]

HTML Label Tag Causes Mysterious Behavior of ASP.NET Button

Recently, because of my ignorance of the HTML label tag, I encountered a very weird problem. I have a page like this: And the problem is no matter which button I click, the “Save Student Record” button is always fired. Even I set a break point on the button clicked event handler of the button “New Search”, the break point never gets triggered. If I switch the Save Student Record button and the New Search […]

Simulate UpdateProgress when Using ASP.NET FileUpload Control

[UPDATE] For those who complain that my example is not working, it is most likely because you don’t know CSS very well. Here are things you need to check if you try to follow my example: 1. Do NOT use UpdatePanel 2. Make sure your image “src” is pointing to your loading gif file. You cannot just copy and paste my code and expect the image to show up 3. Add the following two CSS classes […]

AJAX request timeout error

The default value of AJAX postback is 90 seconds, so if you have a long asynchronous postback, you will get an error as this: Sys.WebForms.PageRequestManagerTimeoutException: The server request timed out. The fix is to change the default timeout value to a larger value in your ScriptManger’s AsyncPostBackTimeout property (10 minutes as below): <asp:ScriptManager ID="ScriptManager1" runat="server" AsyncPostBackTimeout="600"> </asp:ScriptManager>

Invalid Parameter Binding error when using Oracle ODP.NET TableAdapter

If you use Oracle ODP.NET in Visual Studio 2010 (or earlier version) to create a DataTable by using TableAdapter wizard, you may get an Invalid Parameter Binding error if there is a parameter in your query. For example, this simple select query below can cause the error: select * from Person where personId=:person_uid The cause is strange because ODP.NET cannot recognize the parameter’s DbType and thus sets the DbType of the parameter to Object, so […]

ASP.NET Forms Authentication Blocks Images and CSS Files

If you use the ASP.NET Forms Authentication in your web application that runs on IIS 7 or above with the integrated pipeline application pool, you may find that the images and the styles of your application are not displayed until you are logged in (authenticated). If you encounter this problem, here is the solution to fix it. First, let me take one step back to explain why the problem happens. If you look at your […]