URL Rewriting in umbraco for search page and paging

I have a search page inc paging with the follwing url


to rewrite this url to a more friendly url just open the file

and add the following lines

<add name=”Search”
ignoreCase=”true” />


also make sure that you change the paging link urls to
/search/{pageNr}/{query} so the first paging link might look like

save the file, build the project, then touch the web.config to reload yr page
to make sure everything gets newly loaded

so all urls will now have the new url, and it will be translated to

Posted in C#, Umbraco | Tagged , , | Leave a comment

Umbraco contour form summary – Custom field type

Here is a small code to create a summary page in the 2e step of a umbraco contour form

this code is for Umbraco 7+ with Contour 3

First create the contour form and call it forexample “ContactForm”, add 2 or 3 fields “name”, “lastname”, “email”, then add a 2e step, on the 2e step dont add any fields yet, and save the form


now lets create the custom field.

create a class file in the app_code folder and call it “ContactUsSummaryFieldType.cs”

then add the code below, don’t forget to rename the namespace to the one that you are using

using System;
using System.Collections.Generic;
using Umbraco.Forms.Core;

namespace JB.Umbraco.Demo

/// Creates the custom field type to be used in contour forms

public class ContactUsSummaryFieldType : FieldType
public ContactUsSummaryFieldType()
// set the field info, this info is showed when adding this field to a contour form
this.Id = new Guid("**CREATE A NEW GUID AND PLACE IT HERE**");
this.Name = "ContactUsSummary";
this.Description = "Shows the contact us summary in the 2e step of the form";
this.Icon = "contactussummary.png";


/// Text that is being showed in the rich text editor

/// description text
public override string RenderPreview()
return "Contact us summary";


/// you could use this to pre render values into the form fields

public override string RenderPreviewWithPrevalues(List prevalues)
return "Contact us summary";

then create a class and call it “Fieldtype.contactussummary.cshtml” and place that file in the umbraco folder “/umbraco/plugins/views/”

copy and paste the code below

@model Umbraco.Forms.Mvc.Models.FieldViewModel
string formGuid = Request["FormId"];
if (!string.IsNullOrWhiteSpace(formGuid))
string pageId = umbraco.presentation.nodeFactory.Node.GetCurrent().Id.ToString();
string cookieName = String.Format("contour_{0}_{1}", pageId, formGuid);
string recordId = Request.Cookies[cookieName].Value;
dynamic record = null;

if (!string.IsNullOrWhiteSpace(recordId))

// get access to the database where the form records are stored
using (var recordStorage = new Umbraco.Forms.Data.Storage.RecordStorage())
// get the record by id, but the id is a guid
var rec = recordStorage.GetRecord(new Guid(recordId));

// get the dynamic record object, this object is stored as xml in the database in table UFRecordsXML
record = new Umbraco.Forms.Mvc.DynamicObjects.DynamicRecord(rec);

@record.Created.ToString("dd MMMM yyy")

foreach (var field in record.RecordFields)
// First, build table rows for non-editable fields
var fieldName = field.Value.Field.Caption;
var fieldValue = field.Value.ValuesAsString();

@fieldName - @fieldValue



now compile your code, to see if all compiles, it should if you did everything correct

now go back to your created form in umbraco contour in the back end and go to step 2 of you form, and click to add a field and select the contactsummaryfield

save your form, and create a page where you can add the form into, then browse to that page to see the code in action.

hope this helps you out to

Greets JB

Posted in Umbraco | Tagged , , , , , , | Leave a comment

How to grow cannabis aka weed with LEDs part 6

Lefty, P13, and Righty are doing fine (11-05-2013)

Lefty is 10.5cm
P13 is 15cm
Righty is 13cm

P13 is growing the fastest cause she is placed in the center of the Led panel. Also added a HD webcam and wrote software to make time-lapse videos of the plants while they grow. timelapse pictures are taken every 30 min

when P13 reaches 20cm i will set the LEDS to flowering mode, cause now they are on 18 hours and 6 hours off
when going into flowering i will set the LEDs to 12 hours on, and 12 hours off

Lefty 10.5cm

P13 15cm

Righty 13cm

The 3 sisters together
3 sisters

Webcam and laptop added to the growbox
laptop added to the box

full view of the growbox
grow box

Cam manager software i wrote in C# using direct show
Cam Manager by JB aka me

HD webcam in the grow box
webcam in box

Close up of the HD webcam attached to an old telescope so i can easily move it up and down. time-lapse pics are taken every 30 min
cam close up

that’s it for now, but stay tuned and subscribe to my youtube channel for more updates on how to grow weed with LEDs lights

youtube channel johnnblade

Posted in Grow Cannabis / Weed with LED Project | Tagged , , , , , , , , , , , , , , , | Leave a comment

How to grow cannabis aka weed with LED part 5

Finally the clones have rooted and its time to pick the best clones out for myself and give away the other clones to famz and friends for growing outside

i have picked 3 clones and named them Lefty, P13, and Righty
Lefty is about 9cm, P13 is about 10cm, and Righty is about 9.5cm.
Lefty and Righty are going outside, but im thinking of making 1 more clone for outside
P13 is going to stay in the grow box for growing and flowering just to see what kind of buds these leds can produce

here you can clearly see the roots

Lefty, P13 and Righty in their new pots to grow further in for now
Lefty, P13, and Righty

P13 nicely chilling, and added some foil to reflect extra light

All 3 nicely in the grow box, panel is about 15 cm from the clones
clones in growbox

to stay tuned subscribe to my youtube channel

youtube channel johnnblade

Posted in Grow Cannabis / Weed with LED Project | Tagged , , , , , , , , , , , , | Leave a comment

Disaster strikes the cannabis aka weed clones, Rescue mission with Timelapse video part 4

Disaster strikes the clones

The clone grow box with 10 clones inside where fried, burned, overheated and they where looking like some dead salad
so now its time to see if i can save them again. the got overheated cause the sun was to hot while they where by the window. i took of the cover of the clone box, and sprayed every hour some water on the clones to cool them down. after a few hours the where starting to back to life again. while i was doing this i placed my ipad ontop of the clones to make a timelapse of the clones comming back to life again, kinda looks cools

here the clones are 4 days old, and the day before the disaster
4 days old before disaster

clones are 5 days old and disaster strikes
5 days old, disater strikes

lucky the next day the clones where back to normal again, and in a few days these clones will have roots
i will keep the motherplant, 3 clones are going outside, and 1 clone goes in the growbox to see what kind of buds it will produce

stay tuned for more updates

Don’t forget to subscribe to my youtube channel johnnblade

Posted in Grow Cannabis / Weed with LED Project | Tagged , , , , , , , , | Leave a comment

Grow weed with LED light is possible time to clone Part 3

Growing cannabis with LED is possible, here she is 37 days old and i will not make her bloom but i will let her grow
so i can take clones of her. she is about 40cm high, width is about 30cm the panel distance is about 10cm avg temperature 25 degrees humidity avg 40/50 percent

her she is 40cm high and looking and doing good, nice dark green leaves, so its a fact that one can grow a weed motherplant for clones under LED lights
37 days old and looking fine

MD helped me out making some clones, i bought some rockwol cubes and clonex root stimulator.
make sure you soak the rockwoll cubes for about 12 hours in a bucket with water before using them for your clones
The clones are cut off in a 45 degree angle and then placed into a bowl of hand warm water i did not check the PH value
but for clones it should be around 5.5/6.5

got 10 clones for now of her, these clones are placed inside a clone box because the clones need a humidity of about 70 percent, the big fan leaves have been cut off half way to stimulate the clone more. i expect them to have roots within 10 days, and then i will have to give some away to my friends and keep the motherplant because she will be retiring soon
3 clones will go outside to grow and flower, and 1 will grow and flower in the grow box, to see how the buds will be like under these high power leds
10 cannabis clones

make sure only the rockwoll cubes are soaked in water, and after that drain all the extra water away, the bottom of the clone box should be dry
cannabis clone box

ill be posting some more so stay tuned

Don’t forget to subscribe to my youtube channel johnnblade

Posted in Grow Cannabis / Weed with LED Project | Tagged , , , , , , , , , , , , | Leave a comment

How to build high powered led panel and LED constant current driver for cannabis / weed part 2

How to build a weed / cannabis high powered led panel with home made constant current driver

After my first project of building a simple and tiny weed panel, it is now time to build the high powered led panel and the dimmable LED constant current driver for driving the LEDs at 700mA

LEDS used all 0.7mA:
6 x Red 630nm
3 x Blue 460nm
2 x Deep Red 660nm

for the constant current driver
2 x LM317
2 x 1.8 ohm resistors, 2.2ohm can also be used if you wanna be more safe
2 x pot-meters 500 ohm
2 x 1000ohm resistors

You can replace the 0R5 with the 1.8 or 2.2ohm resistor
circuit constant current driver

I started by taking apart an old hall way light that i took from the basement that i will use as the led panel.


First i created the constant current drivers, cause i needed 2 of them cause the blue and deep reds needs to be dimmable, so i can adjust the strength during growing and flowering.

20130511-091656.jpg by now i used only 1 resistor, instead of 2 in parallel like on the pic

The light had a aluminium panel that i will be using to attach the leds to with double sided thermal pads




When i received the leds the supplier made a mistake, by giving me 2 green leds instead of the 2 blues, so i had to wait for the supplier to send me 2 new blue leds. Below im testing the leds and you can clearly see the greens, but i will leave them on the panel for now cause im just testing the constant current driver


testing the normal red leds


testing all leds except the deep reds


here the deep reds, and you can see the constant current driver with pot-meter to adjust the deep reds, full brightness runs at 0.7mA


All leds fixed on the panel, and the 2 constant current drivers are fixed to

had to make some holes in the light casing for the on and of switches, and the potmeterand then build the constant current drivers into the light casing attach on heatsinks

then i added the cpu fan

and now all is complete

here a pic of the top side

LED panel is slided in to the casing
LED panel

attached the LED driver for the 6 red leds to the back of the growbox

Now lets see the old led panel and the current new LED panel
(old setup)
(new setup, still waiting for my blue leds to arrive)
New led panel setup

finally the blue leds have arrived, time to replace the green leds with the blue ones
also replaced her pot for a bigger one
new led setup

Posted in Grow Cannabis / Weed with LED Project | Tagged , , , , , , , , , , , , | Leave a comment

Grow 1 Cannabis / weed plant with LED LIGHT – how it all began Part 1

Hot to grow weed with tiny led grow panel

I got a tiny cannabis plant from my good friend MD
She was about 15cm in height, and looked a bit fragile.

i want her to grow so it was time to start a new project on how to grow cannabis with led light

this got me started

collected a bunch of red, blue, yellow, white leds
1 power adapter of 15v 1.2A
new project

Glued the leds into the frame
LEDS in place

Done, placed the frame inside the box it came with, added small chains so i can hang it up

Placed the led under my tripod and it looks kinda cools, but i think we can do better
Tiny LED panel made

Lets make a box where i can place her into
start of the grow box

Box created, build the led panel into it

had some insulation lying around, so i thought it can help protect the box and reflect more light

now i will let her grow and get comfortable with the box

see part 2 of this project

Don’t forget to subscribe to my youtube channel johnnblade

Posted in Grow Cannabis / Weed with LED Project | Tagged , , , , , , , , , , , | Leave a comment

Wrap long string of text in TD, TH

Here is how to wrap a long string of text in a table cell

for example<td>veryveryveryveryveryveryveryveryveryveryveryverylongtext</td>

Add this in yr style tag or stylesheet

                word-break: break-all;

and your text will be wrapped, I have tested this on Internet Explorer and FireFox

Posted in CSS | Tagged , , , , , , , , | 1 Comment

Drag and Drop Grid Control Row DevExpress WPF

To simply drag a grid row and drop it in another grindcontrol follow these steps below

forexample we have 2 gridcontrols with both a tableview, lets call them
grid1 and gridview1
grid2 and gridview2

first add these 2 events to yr gridview1:

Then add these 2 events and 1 property to yr gridview2:

Then in code behind add this:

using DevExpress.Data;

bool _dragStarted = false;

// this is code for the gridview1

private void gridview1_MouseDown(object sender, MouseButtonEventArgs e)
    int rowHandle = gridViewMedia.GetRowHandleByMouseEventArgs(e);
    if (rowHandle != GridDataController.InvalidRow)
        _dragStarted = true;

private void gridview1_MouseMove(object sender, MouseEventArgs e)
    int rowHandle = gridview1.GetRowHandleByMouseEventArgs(e);
    if (_dragStarted)
        DataObject data = CreateDataObject(rowHandle);
        FrameworkElement element = gridview1.GetRowElementByMouseEventArgs(e);
        if(element != null)
            DragDrop.DoDragDrop(element, data, DragDropEffects.Move | DragDropEffects.Copy);
        _dragStarted = false;

private DataObject CreateDataObject(int rowHandle)
    DataObject data = new DataObject();
    data.SetData(typeof(int), rowHandle);
    return data;

// ------------------------

// this is code for the gridview2

private void gridview2_DragEnter(object sender, DragEventArgs e)
    e.Effects = DragDropEffects.Copy;
    e.Handled = true;

private void gridview2_Drop(object sender, DragEventArgs e)
    int rowHandle = (int)e.Data.GetData(typeof(int));
    MyObject myObject = (MyObject)grid1.GetRow(rowHandle);
    if (myObject != null)
	// this is just a list/ List<MyObjects>

	// clear the datasource, and reload it the datasource with the new object added to the collection
	grid2.ItemsSource = null;
	grid2.ItemsSource = _droppedItems;
	// optional remove the focus from the grid
	gridview2.FocusedRowHandle = -1;

	// remove the row from the grid1

// ------------------------
Posted in WPF & DevExpress | Tagged , , , , , | Leave a comment