Sharepoint lead is a place where you can read about interesting topics related to sharepoint, and you can also post comments and suggessions.

Wednesday, April 23, 2014

ascx.g.cs Empty

In Visual Studio 2012, when you are working with a visual web part, your user control's ascx.g.cs file becomes empty. So you get an error "The name ‘InitializeControl’ does not exist in the current context".

Root cause:
This is reported as a bug in visual studio 2012 and it generally happens when your server side mark up is having issues. This ONLY happens when you are editing your ascx file.

Suggested Solution:
You can try following:
Short way:

  • try to undo some of the last changes in ascx file.
  • Create copy of ascx file and revert it from source control. Rename g.cs to g.txt and switch to ascx and hit save. That will generate another g.cs with correct content

Long way:

  • Please check the @Register declarations against the TagPrefix and TagName that you are using.
  •  Try to comment out all controls in ascx and save it. That will generate ascx.g.cs along with content again. Now start un-commenting the controls one by one.
  • In worst cases, after trying lots of things people also switch to new web part and migrate useful code from the problematic web part step by step to resolve the error. 

Wednesday, April 16, 2014

Keep it up

Sometime back when Rajasthan Royals won the first IPL, I was working with Virtual Lifestyle Pvt Ltd, and CEO Vikas Sabnani explained how Rajasthan Royals being a cheapest team, won the game. Here are three things that he noticed that applies to every team and team players of the world.

  1. Focus on Quality
    Being an important member of the team, if you do so, you are not achieving for yourself and team at the same time. Focusing on quality is as easy as you read it.
  2. Be Proactive
    Here is what the definition says: "creating or controlling a situation rather than just responding to it after it has happened." There are great example of proactive work but in our software world, detecting & fixing or implementing stuff ahead of time with the best suited and most efficient way
  3. Have fun!
    Having fun with what you do is also as important as the other two.
If you are doing it all three together, you are doing it right! If not, what are you waiting for?