2016-12-16 58 views
2

我剛開始學習Kentico 9並嘗試製作自定義Web部件佈局(https://docs.kentico.com/k9/custom-development/developing-web-parts/advanced-web-part-development-scenarios/developing-layout-web-parts)。在他們的示例代碼,他們有:IsDesign與PortalContext.IsDesignMode的區別()

if (IsDesign) 
{ 
    Append("<table class=\"LayoutTable\" cellspacing=\"0\">"); 

    if (PortalContext.IsDesignMode(this.ViewMode)) 
    { 
     Append("<tr><td class=\"LayoutHeader\" colspan=\"2\">"); 

     // Adds a header container. 
     AddHeaderContainer(); 

     Append("</td></tr>"); 
    } 

    Append("<tr><td>"); 
} 

我感到困惑IsDesign財產和PortalContext.IsDesignMode()方法之間的區別。他們工作是一樣的嗎?如果不是,在什麼情況下他們會產生不同的價值?

謝謝。

回答

0

CMSAbstractWebPart.IsDesign增加了一些額外的邏輯,使其更加健壯和可靠(它涵蓋了一些邊緣案例,如livesite編輯等)使用那一個。