Month: September 2013

Then OnPageEdit is missing

Posted on

Episerver has a helper method @Html.DisplayFor(m => m.MainIntro) which basically writes MainIntro in ViewMode and make editable green rectangle in EditMode (OnPageEdit). But not always it works and I don’t know why. Below are some tricks to force it to render blue (green when hoovering) rectangle while in OnPageEdit. First is just string, second is ContentArea.

    <div class="intro" @Html.EditAttributes(m => m.CurrentPage.MainIntro)>
        @Html.PropertyFor(m => m.CurrentPage.MainIntro)
    </div>

onPageEdit episerver 7

There is @Html.DisplayFor here

    if (PageEditing.PageIsInEditMode)
    {
        <div class="footer-partners">
           @Html.DisplayFor(m => m.Footer, new { CssClass = "footer-partners", EditContainerClass = "footer-partners" })
        </div>
    }
    else
    {
       @Html.DisplayFor(m => m.Footer, new { CssClass = "footer-partners", EditContainerClass = "footer-partners" })
    }

I am using EditContainerClass like in the post How EPiServer’s HTML helper PropertyFor works. Maybe on my pages there is something wrong in the markup in other places and we don’t have time to investigate? I am just Back End developer and this tricks helped me 🙂

Jira

Posted on

jira epics in plan

• Zapomniałem jak się robi to ze Sprint1, Plan i idziemy na dół po levej i przesuwamy do Sprint1. Idziemy najpierw na Epic, a później create issue w Epic i przesuwamy do Sprintx.

Co rzucić z kodu aby otrzymać 404 (MVC)

Posted on

throw new HttpException(404, “Some description”)

Coś tam po drodze może się zdażyć więc oryginał:
http://stackoverflow.com/questions/2948484/how-to-get-mvc-action-to-return-404

Passing data to built-in framework properties

Posted on

You will need to override the default rendering of i.e. LinkItemCollection

@Html.PropertyFor(x => x.Links, new { @class="nav nav-tabs"})
@using EPiServer.SpecializedProperties
@model LinkItemCollection
<ul class="@ViewData["class"]">
    @foreach(var linkItem in Model ?? Enumerable.Empty<LinkItem>())
    {
        <li class="@ViewData["itemClass"]">@Html.PageLink(linkItem)</li>
    }
</ul>

http://joelabrahamsson.com/episerver-7-and-mvc-how-to-customize-rendering-of-properties/

GenericListProperty is too low EditMode

Posted on

too low GenericListProperty

It takes only 30% of height.

Workaround is too close it and open again – then it would have full height. It stays correct when you are editing many pages and gets reset when make full refresh.

GenericListProperty empty list in View Mode

Posted on

I am using OpenWaves.EPiServer.GenericListProperty.

I had a problem when my list was populated in EditMode but was always empty in ViewMode.
Two solutions:

  1. You add two lines to episerver.config

    <siteSettings
      stringDelayedLoadThreshold="0"
      stringCompressionThreshold="0"
    />
    
  2. Remove properties from code, compile, remove from AdminMode, add again and should work.

I prefer the first one.

Resharper 8 find your view in MVC

Posted on Updated on

Resharper 8 has some new stuff:

  • You don’t have to enter Ctrl+Shift+N to get search for all files. Ctrl+N is enough. No distinction like in R#7
  • You don’t need to write camels: ArtP to search for ArticlePage, now you just write ‘anything’ like ‘arpa’ and it feets ArticlePage.
  • Finding your view is much easier. To find you Index.html for corresponding ArticlePage you can write ‘arpa.csh’.
  • anything you type looks as well for directories (path)
    resharper finds by directory tree

The drawback is that you have more things to deal in this small window. However it is not a big deal 🙂