{"id":106,"date":"2007-11-12T20:37:00","date_gmt":"2007-11-12T20:37:00","guid":{"rendered":"https:\/\/wdev-blog.azurewebsites.net\/index.php\/2007\/11\/12\/distinguish-design-time-in-asp-net\/"},"modified":"2007-11-12T20:37:00","modified_gmt":"2007-11-12T20:37:00","slug":"distinguish-design-time-in-asp-net","status":"publish","type":"post","link":"http:\/\/panahy.nl\/index.php\/2007\/11\/12\/distinguish-design-time-in-asp-net\/","title":{"rendered":"Distinguish Design time in ASP.NET"},"content":{"rendered":"<p>From <a href=\"http:\/\/msdn2.microsoft.com\/en-us\/library\/aa479009.aspx\">MSDN <\/a>site:<\/p>\n<p>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.<\/p>\n<p><span style=\"font-size:85%;\"><span style=\"color:#0000ff;\">Private<\/span><span style=\"color:#000000;\"> <\/span><span style=\"color:#0000ff;\">Function<\/span><span style=\"color:#000000;\"> IsDesignMode() <\/span><span style=\"color:#0000ff;\">As<\/span><span style=\"color:#000000;\"> <\/span><span style=\"color:#0000ff;\">Boolean<\/span><\/span><span style=\"font-size:85%;\"><span style=\"color:#000000;\"><br \/><\/span><span style=\"color:#0000ff;\">    Try<\/span><\/span><span style=\"font-size:85%;\"><span style=\"color:#000000;\"><br \/><\/span><span style=\"color:#0000ff;\">        If<\/span><span style=\"color:#000000;\"> HttpContext.Current <\/span><span style=\"color:#0000ff;\">Is<\/span><span style=\"color:#000000;\"> <\/span><span style=\"color:#0000ff;\">Nothing<\/span><span style=\"color:#000000;\"> <\/span><span style=\"color:#0000ff;\">Then<\/span><\/span><span style=\"font-size:85%;\"><span style=\"color:#000000;\"><br \/>            mboolDesignMode <\/span><span style=\"color:#000000;\">=<\/span><span style=\"color:#000000;\"> <\/span><span style=\"color:#0000ff;\">True<\/span><\/span><span style=\"font-size:85%;\"><span style=\"color:#000000;\"><br \/><\/span><span style=\"color:#0000ff;\">        Else<\/span><\/span><span style=\"font-size:85%;\"><span style=\"color:#000000;\"><br \/>            mboolDesignMode <\/span><span style=\"color:#000000;\">=<\/span><span style=\"color:#000000;\"> <\/span><span style=\"color:#0000ff;\">False<\/span><\/span><span style=\"font-size:85%;\"><span style=\"color:#000000;\"><br \/><\/span><span style=\"color:#0000ff;\">        End<\/span><span style=\"color:#000000;\"> <\/span><span style=\"color:#0000ff;\">If<\/span><\/span><span style=\"font-size:85%;\"><span style=\"color:#000000;\"><br \/><\/span><span style=\"color:#0000ff;\">            Return<\/span><\/span><span style=\"font-size:85%;\"><span style=\"color:#000000;\"> mboolDesignMode<\/p>\n<p><\/span><span style=\"color:#0000ff;\">    Catch<\/span><\/span><span style=\"font-size:85%;\"><span style=\"color:#000000;\"><br \/><\/span><span style=\"color:#0000ff;\">        Throw<\/span><\/span><span style=\"font-size:85%;\"><span style=\"color:#000000;\"><\/p>\n<p><\/span><span style=\"color:#0000ff;\">    End<\/span><span style=\"color:#000000;\"> <\/span><span style=\"color:#0000ff;\">Try<\/span><\/span><span style=\"font-size:85%;\"><span style=\"color:#000000;\"><\/p>\n<p><\/span><span style=\"color:#0000ff;\">End Function<\/span><\/p>\n<p><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 &hellip; <a href=\"http:\/\/panahy.nl\/index.php\/2007\/11\/12\/distinguish-design-time-in-asp-net\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Distinguish Design time in ASP.NET&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[34],"tags":[],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"post-thumbnail":false},"uagb_author_info":{"display_name":"Pouya Panahy","author_link":"http:\/\/panahy.nl\/index.php\/author\/pouya\/"},"uagb_comment_info":0,"uagb_excerpt":"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&hellip;","_links":{"self":[{"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/posts\/106"}],"collection":[{"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/comments?post=106"}],"version-history":[{"count":0,"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/posts\/106\/revisions"}],"wp:attachment":[{"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/media?parent=106"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/categories?post=106"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/tags?post=106"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}