Coding is Fun, Coding is Boring, Coding is Love!

Tutorials and Snippets for easy life.

  • Force a file to download in asp.net c#

    In web applications you may need to download image, zip files, doc files, pdf files, text files. Luckily, Pdf files zip files, doc, docx files will download but images will be displayed by browsers. To force any file to download, we can use the following…

  • Converting String to Guid in ASP.net

    To convert String to Guid, the snippet is

  • ASP.NET Membership – Get UserName from UserID or Userkey

    To Get the UserName from the ASP.NET membership tables using the UserID or Userkey the following snippet will work. First add the Label Control in the .aspx page Now the snippet in the code behind, in the snippet if you have the UserID first we…

  • ASP.NET Membership – Get UserID from Username

    To Get the UserID or UserKey of the logged in User from the ASP.NET membership tables the following snippet will work. First add the Label Control in the .aspx page Now the snippet in the code behind. In the snippet User.Identity.Name gets the current loggedin…

  • Converting color image to Grayscale in Illustrator CS5

    Converting color image to Grayscale in Illustrator CS5

    When you are working in Adobe Illustrator you may have to convert an image from color to Grayscale for printing purposes or for any other requirements. Converting image to grayscale is simple. 1. After you place the image in the illustrator, Select the image 2.…

  • ASP.Net countries dropdownlist

    For every project we need dropdownlist of countries. Here is the snippet i want to share and use it myself often, so it is handy. The dropdown list comes with country name as text and its 2 letter code as its value.

  • ASP Page Access Timer

    If you want to know how long your ASP page takes to load from your server. Here is a two lines of code, which accurately calculates the time taken for a page to load. This tutorial uses the TIMER function of the ASP. The logic…

  • Getting First N words from strings or a title in C#

    We can use regular expression to get the first N words from a title or strings. The following example shows how it can be done. This example utilizes RegularExpression namespace eg Result I want only

  • Using IF Then Else in Eval in ASP.NET

    When using Eval in your gridview or datalist view, we will bind the coloumn value using the Eval statement. Sometimes we need to check if the value of the Eval exists so that we can take appropriate mesures. For example checking the image value if…

  • Retrieving ID or other values from the DataList in ItemDataBound Event

    When using DataList control, you may want to obtain the ID or other values from the item in the DataList ItemDataBound Event using the following snippets in asp.net and C# There are two cases and you can get the values from the both case 1.…