Developing layout web parts - documentation example

Mateusz Żebrowski asked on January 14, 2015 13:43

In documentation for Kentico 8.2 I found article "Developing layout web parts". In step 7 is following code:

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>");
}

I don't understand why we have if(PortalContext.IsDesignMode(this.ViewMode)). Didn't we just ensure that all that Append methodes will fire only in designe mode when we wrote if(IsDesign) at the begining?

Recent Answers


Roman Hutnyk answered on January 14, 2015 23:03

Have you tried to debug that code? Does IsDesign == PortalContext.IsDesignMode(this.ViewMode) all the time?

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.