Archive for February, 2012

Getting the Version of SharePoint Installed

February 21, 2012 4 comments

I am not discussing about something which seems to be rocket science , Though ,being through many blogs , i saw some people are getting these things from system registry. But what if the system is upgraded with SharePoint 2010 and previously MOSS was installed ?.

The easiest way to get the installed version , whether it is WSS , SharePoint Foundation , MOSS or SharePoint 2010.

You need to add the SharePoint assembly reference first.

using Microsoft.SharePoint;

using Microsoft.SharePoint.Administration;

Then simplest way to get the version in.

string SharePointVersion = SPFarm.Local.BuildVersion.ToString();

Happy coding 🙂

Troubleshooting with Asynchronous post back errors or Error occurred in Ajax control toolkit.

February 7, 2012 4 comments

Its often hard to identify the error occurred in scripts , specially with asynchronous post backs and Ajax update panel.

A good and affective way to identify is described by Mr. Aqeel (An experienced SharePoint developer) to me and i am very glad write it here.

ScriptManager.GetCurrent(this.Page).AsyncPostBackError += new EventHandler<AsyncPostBackErrorEventArgs>(UC_AsyncPostBackError);

I have user control which populates the data and some scripts are being attached to it.

so declared the event  AsyncPostBackError in page load of that user control.

Then into the even of AsyncPostBackError.

void UC_AsyncPostBackError(object sender, AsyncPostBackErrorEventArgs e)
              string exc = e.Exception.Message;
          catch (Exception ex)


This would let you know the exact exception occurred.