Bill Software Engineer
Bill Software Engineer

Reputation: 7782

How to detect design time in aspx

Basically I would like to modify my CSS file under design time. And the easiest way I can think of to do it is to just comment out a block of CSS/JS code in my Master ASPX page. How do I do this? Is there anyway to detect design time in ASP.NET?

Upvotes: 2

Views: 295

Answers (1)

Rahul Tripathi
Rahul Tripathi

Reputation: 172418

The quick way to detect is:

if (HttpContext.Current == null)
// You're in design mode

or

  if (this.Site != null && this.Site.DesignMode == true)
  {
    // Design Mode
 }
 else
 {
    // Run-time
  }

Upvotes: 3

Related Questions