Here I have written a small function to determine whether control is loaded in Design View or Run time. Accordingly We can take decision whether to use HTTPContext or not.
public bool IsInDesignMode()
{
if (HttpContext.Current == null)
return true;
else
return false;
}
-- Thanks Deepak Rai