Solution: Make an entire table row clickable

April 27th, 2014

To enable an entire row clickable with a specific link in a table has been a recurring problem for web developers. There are some solutions on the web, but they all seem to be lacking in some way or another. Here is my solution to link an entire row in a table, including working context menu and control click to open in new tab.
Read the rest of this entry »

How to set up logging with NLog in a .NET project

March 1st, 2014

Logging is quite useful, and one popular tool for .Net logging is log4net. Another really nice tool is NLog. Here’s how to implement logging and configure NLog for your website in a few steps.

Read the rest of this entry »

Yet another… How to upgrade to EPiServer 7.5

February 9th, 2014

I struggled with the upgrading from EPiServer CMS 7.1 to EPiServer 7.5, even if there are several good blog posts about this already (Ted & Gustaf, David Vujic) it seems everyone comes up with new obstacles so I thought I’d share my step-by-step guide.

Read the rest of this entry »

AJAX: Bring attention to an updated element

February 9th, 2014

Sometimes when you’ve updated existing content on the users screen via AJAX you might want the updated part
flash or highlight in some way to illustrate what part of the page was just updated.
There might be other reasons to bring attention to a certain area of a page too, possibly a missing value, notification etc.
Read the rest of this entry »

AJAX: Javascript templating for updating html with JSON response

February 9th, 2014

Updating a web page with new data from a response after an AJAX call is a very common task, but still many developers send entire html chunks in the response to the javascript, probably mostly due to laziness, while others send JSON but have prepared html in the javascript file which isn’t much better and could be a hassle to modify at a later stage.
Read the rest of this entry »

How to add an ajax loader to your website

January 22nd, 2014

We all love AJAX calls, but it’s important to show the visitors that the page is loading.
Here’s an easy way of implementing a generic AJAX loader image to your website which is shown for all ajax calls.
Read the rest of this entry »

Sorting columns using a list of objects (c#)

September 17th, 2013

Rendering a collection of items in columns could be problematic, at least if you want to sort the items vertically in each column, or you need to use separate surrounding html tags for some reason.

Example: You have a list of letters – a, b, c, d, e, f – and you want to group them like this:
a   c   e
b   d   f

Here is a method I wrote for grouping items into an array of optional size (i.e optional number of columns), which can be used to render any desired columned sorting, vertically or horizontal. This means we don’t have to do some weird clientside hacks using javascript and/or CSS.

The method takes three arguments; a list of any type of objects (either value type or reference type), the number of columns you want to render, and an optional parameter to specify if the sorting should be vertical or horizontal.

Read the rest of this entry »

Arrow image after external links – CSS tweak

September 17th, 2013

Here’s a little CSS tweak to have a custom image, like this shown directly after any external links in a list. By external, I mean they begin with http even though you could argue that internal links with a full absolute URL also could begin with that as well.
Read the rest of this entry »

The type arguments for method cannot be inferred from the usage

August 19th, 2013

Visual Studio can have problems understanding LINQ expressions in Razor views, complaining with the recurring error message when hovering the inline expression:
“The type arguments for method … cannot be inferred from the usage. Try specifying the type arguments explicitly.”

Even though the code is correct and everything works as expected, the MVC view gets cludded with warnings and Intellisense doesn’t work inside the LINQ expressions.

Solution:
Add targetFramework="4.0" in the compilation node in web.config, and then re-compile:

1
<compilation defaultLanguage="c#" targetFramework="4.0">

On-page editing and forms editing stop working in EPiServer 7

April 23rd, 2013

Working in EpiServer 7 we discovered that some pages, without any obvious reason, were suddenly not editable anymore.
Navigating in edit mode, the particular pages did not get the onpage edit borders and clicking the forms editing button would just make the ajax loader keep going forever. No errors in the logfile either.

After some troubleshooting, we found that the defective pages became corrupt as soon as the property Preamble was edited.

The solution was to rename the property “Preamble” to something else. It seems any property at all named “Preamble” will cause this error. Why that causes corrupt pages though, remains a mystery.

Environment:
EPiServer CMS 7 patch 2 with “EPiServer 7.1″ Add-On package. (7.0.586.8 + 7.1 Add-ons)