August 07, 2012
I’m currently working on a small NuGet module for EPiServer CMS, and I thought it’d be cool to implement a RESTful API using the ASP.NET Web API. However, as you probably already know, you need to make certain adjustments to the Global.asax file to set up some routing so that any requests made is redirected to the appropriate controllers.
This is fine if you’re implementing Web API into your main project, but not if you’re trying to get it working in a 3rd party module. You really don’t want anyone who installs your module to have to unnecessarily edit anything on their end. It’s just bad design.Read more »
July 16, 2012
Every now and again I get into this situation where I have a list, and some JS function will retrieve more stuff via Ajax to insert into that list. This is normally fine if you stick to normal lists, but once you start using DIVs (eg. grid) and whatnot things start to get a bit more complicated. For one, you will have to make sure the item you’re appending to the list uses the same template as the existing items, for consistency.
So the question I normally get asked is, “What’s the best way to display the new list items in this kind of situation?”.
There are a couple of ways to do this, and in most cases they all output the same stuff. The only difference is the speed in which the job gets done.Read more »
July 10, 2012
However, working with ASP.NET, there are times when appending your JS files to the bottom of the page is not an option, especially so when you work with partial views in which your JS functions accepts parameters generated by the application. For example, you have a partial view that accepts some parameters from some other view which is then used in one of your JS functions. But you want to include the jQuery library at the bottom of the page to reduce your initial loading time. However, the function you’ve included in your partial view relies on jQuery being defined before the partial view. So now the script fails because $ or jQuery is undefined when the browser hits it.Read more »
June 18, 2012
parseJSONmethod. The resulting array is then ran through another function which does some calculations and displays the results in a list.
for...inloop, in which a calculation method is applied to every item in the array. However, for some reason, the list contained one extra item with the value
NaN. Upon inspecting the array, I found that there was an extra item called
map, which was a function. You can probably already guess by now why the calculation didn’t work as it was expected to, and rightly so, especially when the value used in the calculation was a function.
May 15, 2012
I’ve been working on this small plugin for EPiServer CMS 6, and I wanted to add it to a custom top menu created by another plugin that I had helped develop. I wanted to append the link for my plugin into the same top menu as that other plugin. The only requirement is that my plugin will still display the same top menu even if the other plugin is not installed.
Unfortunately, after a lot of time Googling and forum crawling, I came to the conclusion that it was just not possible to append an item to a top menu dynamically. I didn’t bother looking at solutions that involved me editing the project’s web.config file, which may have helped, since the other plugin already had some code which adds a top menu item to the top menu bar. So I figured I should probably try to use that instead.Read more »