This project is read-only.


Page dedicated to the latest news, tips & tricks etc. from the DEWDverse.

2011-08-14: It's not quite dead...

by Sune aka the-dewd-dude

Finally got around to giving DEWD some time and energy, which some may say, was very much overdue as the project has been dead in the water for about a year - some may say that, I say: Patience, Young Skywalker :) I don't have a personal blog or anything, so for now I'll just do some "posts" here on CodePlex. Feel free to comment at the bottom of this page.

Anyways, so I just want to give a little info about some of highlights in v1.2 (available now on the download page: DEWD for Umbraco v1.2). There's obviously a lot of bug fixes in there and it's been tested thoroughly on Umbraco v4.7 (and fairly well on and 4.5.2 as well), so I recommend start using the new version instead of v1.1. Now about the new things in v1.2:

XML intellisense
From a developer perspective this is probably the must helpful new thing in v1.2. I've written an XSD from scratch (which was a painful experience by the way, whoever came up with XSD should be hit with a cactus.. repeatedly) to enable intellisense in Visual Studio. When editing the XML, it will suggest elements, attributes, attributes values and so on, making configuration A LOT easier and requiring less copy-pasty-ish. It's included in the package and the XSD is placed in the config-folder so no configuration should be required - although for VS 2008 you might have to copy the XSD to a special folder (google it or ask me, if in doubt).
By the way, you can use the XSD for v1.1, if you don't want to upgrade right away. You can get it by downloading the 1.2 package and unzipping it and placing the XSD file in the config folder manually.

Events in configuration file
DEWD has supported events such as BeforeSave, BeforeDelete etc. for a while, but until now it was necessary to implement a custom Editor to do it and it was sort of a hidden feature. Now the configuration file supports events directly, so in the editor element you can add the events you want to handle, like so:

<editor tableName="MyTable">
   <event name="BeforeSave" handler="MyNameSpace.MyClass.MyMethod,MyAssembly" />
And in the static method (in this case MyMethod), you can handle the event:
using Eksponent.Dewd.Editors;
public class MyClass
    public static void MyMethod(object sender, BeforeSaveEventArgs e)
        System.IO.File.WriteAllText(HttpContext.Current.Server.MapPath("/test.txt"), "i wrote a file instead, muhahaa");
        e.Cancel = true; // this cancels the save event
You can cancel the event (as shown in the example), write a message back to the user, use the Eksponent.Dewd.Context class to get the current Repository/View/Editor etc., so it should cover most uses and if it doesn't it's still possible to make a custom Editor instead.

Custom and build-in buttons
Another new feature for enhancing DEWD with custom functionality is the ability to add your own buttons to the top panel on both the view and edit page. This allows you to meet client specific needs in a faily simple way:
<editor tableName="MyTable">
   <button icon="/scaryIcon.png" text="Scare end-user" handler="MyNameSpace.MyClass.MyMethod,MyAssembly" />
And the code that handles the event:
public class MyClass
   public static void MyMethod(object sender, EventArgs e)
      throw new ApplicationException("You have pressed a button. The system will self-destruct in 5 seconds. Have a nice day!");
It's possible to handle a client click-event before posting back to the server or do purely client-side event handling by using the onClientClick attribute.

Export to Excel
DEWD v1.2 comes with a build-in button, that allows the end-user to export the data from the view to Microsoft Excel, which should work on most data (although it has only been tested on DataTable-based data so far). It's easy to set up:
<view name="My View">
   <button type="ExportToExcelButton" />
Hope to be able to add more build-in functionality like that in the future.

That's it for now. I'll cover some more features in another post soon. Comments, questions, suggestions etc. are of course welcome, so feel free to get in touch.

Last edited Aug 16, 2011 at 8:33 PM by suneboeegh, version 7


rjbullock Nov 27, 2012 at 8:03 PM 
Awesome! DEWD is the single most useful Umbraco package I've come across right behind uComponents... Use it in many projects. Thanks!

Sniff Aug 16, 2011 at 9:10 PM 
Nice update, awesome job! :)
Though, perhaps, instead of the funny exceptions thrown, I was thinking it could be nice with some real world examples to show whats possible to do with the different custom stuff.