From MSDN site:
The easiest method to check if the control is at design mode is simply to check the current HttpContext. If this variable returns Nothing, then the control is in design mode.
Private Function IsDesignMode() As Boolean
Try
If HttpContext.Current Is Nothing Then
mboolDesignMode = True
Else
mboolDesignMode = False
End If
Return mboolDesignMode
Catch
Throw
End Try
End Function