Archive

Posts Tagged ‘My Stuff’

c# Coalesce function

November 16th, 2011 No comments

When you’ve been working heavily with c# for a few days, coalesce jumps into your head for a lot of c# issues. Heres a little helper to provide coalesce in .net

/// <summary>
/// Returns the first non null value, same as SQL's COALESCE()
/// </summary>
/// <param name="p">Args array</param>
/// <returns>First non null value</returns>
public static String Coalesce(params object[] p)
{
	foreach (Object o in p)
	{
		if (o != DBNull.Value && o != null)
		{
			return o.ToString();
		}
	}
	return "";
}
Categories: c# Tags: ,

jQuery – Syncing select options

November 4th, 2011 No comments

I had a requirement for a series of select boxes that required the related one to only allow selections above the first. I created a little utility function that enables and disables the options based on a function you supply.  Usage is pretty simple. Pass in the first and second select as jQuery objects, then pass in your function that evaluates whether an option is enabled or not.

Read more…

Categories: JQuery Tags: ,

UAD8: Query String Builder

March 13th, 2011 No comments

Ever had controls that need to add to the Query String but not duplicate or erase what’s already there? This is a little utility I dug out and just changed to use a generic dictionary recently. Just use it as you would a normal dictionary. When you instantiate a copy it picks up the current query string. There are two ToString() methods, one just return the query string and the other appends another string to the end and takes care of the ? & issues.

Read more…

Categories: Asp.Net, c# Tags: ,

jQuery equal height columns

May 12th, 2010 No comments

Sometimes equal height columns via css can be an absolute nightmare! If you’re using jQuery for other items on the page you can cheat with the following function :

function setEqualHeight(items) { var highest = 0; items.each( function(){ current = $(this).height(); if(current > highest){ highest = current; } }); items.height(highest); };
Read more...
Categories: JQuery Tags:

CMS Update – Preparing for BETA!

February 4th, 2010 2 comments

It’s been a bit quite round here recently! Don’t be fooled! The CMS is more or less finished. Just refactoring and preparing bits and bobs.

The actual core itself hasn’t really changed in 6 months and is independent from the CMS, it handles all the page, content and control creation with a single base class that you can implement to create page renderers for any page type. Current renderers are the LiveEdit renderer, Content Block, File Include and Rss (Mobile next).

Read more…

Categories: Asp.Net, cms Tags:

IE7/8 and hover on empty elements

November 17th, 2009 No comments

I had an annoying problem with IE8 today. In the CMS, toolbars appear when you hover over a content block or the page content. All I’ve done is user div:hover.

IE though does not recognise the object if its background is set to transparent and is empty. If you set a background colour then it fires the hover. I tried giving it hasLayout but that made no difference! Very strange behaviour!

Read more…

Categories: css Tags: