Jul 24th, 2009 | No Comments

Today I went through one of the video that showed how to work with LINQ and while going through I saw something which I had seen many a times before but everytime I forget about that, but this time I remembered.

What I saw was the person who showed a small demo on the LINQ started to write something, in the class he wrote some 2-3 words and the code for the class appeared automatically. I used to wonder on how they do that so I thought let me check on that, you just write couple of words and you have your class ready with you. After doing some research on that here is what I have.

This is a small Add-on for Visual Studio called as AutoCode which helps you to create a shortcut for a piece of code which you use regularly. What it does is helps you to create a template for the most used code and set a shortcut for that, the next time you want to use that piece of code you need not write that code again all you have to do is type the shortcut you have set for the code that that code will be there. Amazing!!!!!!

You can download the Add-on from here. Also check out the quickstart that will help you to learn how you can start using the AutoCode Add-on.

So start using the AutoCode and save your time by saving the repetative code to be used by just a shortcut.

Written by Ajay Matharu

July 24th, 2009 at 9:34 am

Jul 22nd, 2009 | No Comments

Another one of those problems that can stump you for a while. I often make backups of files as I progress and sometimes leave them in the website folder, this was fine with classic ASP but as I have found with ASP.Net can cause all sorts of problems.One issue I was having was trying to reference a component in my aspx page from the codebehind page and seeing the following error when trying to reference a label control:

“Label2 does not exist in the current context”

So I found that the problem was even though I renamed one of my old files it still contained the class that my codebehind was referencing (i.e. the class names were still the same) – and therefore was not seeing the newly added Label control to my new code.Shame the compiler doesn’t realise the duplication and give some indication.

Lesson: Remove any backed up files from the web folder and/or build directory to avoid pain )

Written by Ajay Matharu

July 22nd, 2009 at 11:24 pm