Author Archives: admin

How to get Start Date and End Date of Current Month in SQL

Here I am sharing a simple technique to get start date and end date of current month in sql.

You can replace getdate() with any date to find the first and last date of that month.

How to limit input control to accept only numeric or alpha numeric

Often it is a pain in the neck to validate text boxes for invalid characters. In some cases we expect only numbers, in some cases alpha numeric. It is easy to fix this issue with jquery

Add this snippet your js file or page. Make sure you referenced jquery. Now simple use the class “alphanumericOnly” for the text boxes for alpha numeric, and “numericOnly” class for text boxes which expects numeric only.

How to set cookie with javascript

A simple yet useful code. Setting cookie with javascript.

It can be useful we try to store somevalue from the client side itself.

How to clear cache of web browser control in C#

Its been a long time since I wrote anything here. So I decided to come with something very interesting. It is often a headache when we work with web browser control in C#. Clearing cache in web browser control will be a requirement in some cases. I had the same issue once, and I asked to my friend “google”, as always he gave me a solution. I got a code from internet. It was a bit messy and buggy. I modified it in my way, simplified it. Now I have a perfect code to clear cache in web browser control. I am sharing it with you guys..

This was a great addition to my code vault. I hope it will be helpful for you. Cheers

How to get notified via email on error in your application

I am presenting here a simple but useful way to get notified via email, when ever an error is happening in your asp.net application with out using try catch. I am creating a httpmodule in app_code for notifying errors. Here is the code for the module.

I am using my “EmailSender” utility for sending emails here. You can find that here. Using this method, first you should create a folder “MailTemplates” in your root folder and add a html template file for “ErrorNotification.htm” in that folder. You can get the referance for creating the html email template from here. Now add the following code in EmailSender class

You are almost done. Now we need to add the module to our application’s configuration file. Add the following configuration value to your web.config, inside system.web and system.webserver (for IIS7).

Hurrey, so it is done. Cheers and Happy coding.