Archive

Archive for the ‘c#’ Category

Creating .Empty properties

November 1st, 2010 No comments

When creating type classes it can be useful to have an .Empty property so you know if an item has been populated. Its quite easy to achieve. All we do is create an instance of the class as a static property. Then we compare our instance to this one when we need to check.

Read more…

Categories: c# Tags:

Working with vague dates (90′s, Sept 2000 etc.)

December 16th, 2009 No comments

On a recent project I had to allow users to upload their memories. Memories are vague things and I had to enable users to upload and assign incomplete dates. They needed to be able to enter ‘The 90′s’ or ‘September 2000′ as well as complete dates ’1st Feb 2009′.

Read more…

Categories: c# Tags:

Get Rendered Html From a Control

November 16th, 2009 No comments

Whilst working on the CMS I needed to be able to pass back the html a control will render when the user first adds it. The control doesn’t exist on the page yet as the sections are added via javascript. It was very easy to pass in StringWriter to the render function to get the html :)

Read more…

Categories: Asp.Net, c#, cms Tags:

CMS Framework – Update

August 16th, 2009 No comments

Been a bit quiet round here lately but not because I’ve not been working on it ;) I’ve been using it for a project at work and converting a lot of my stuff to be compatible with it.  It’s running  a site atm and doing well.

Alpha State

Mainly in alpha because things may yet change but the following all work
Read more…

Categories: .net, Asp.Net, c#, cms Tags:

Simple way to create a singleton

April 28th, 2009 No comments

Found this is microsoft official line on creating a singleton, much simpler than the normal GOF way :)

// .NET Singleton
sealed class Singleton
{
private Singleton() {}
public static readonly Singleton Instance = new Singleton();
}

Categories: .net, c# Tags:

Create controls dynamically from database

February 11th, 2009 No comments

In my cms’ I usually have the option of creating controls from the database. This is just a simple use for reflection but allows me to add controls to page just by adding a new row.  If its one of my controls it supports a persistance system that allows the control to save and restore itself easily.

Read more…

Categories: .net, c# Tags: