Links that have caught our interest

By gareth

Over the last few weeks we've had a lot of links sent round internally. So I'd thought I would collate and blog them.

CSS:

http://www.sitepoint.com/article/tomorrows-css-today

http://www.leigeber.com/wp-content/uploads/2008/04/css-cheat-sheet.pdf

http://www.noupe.com/css/using-css-to-do-anything-50-creative-examples-and-tutorials.html

http://www.smashingmagazine.com/2007/03/19/40-designtech-magazines-to-read/

Design: 

http://www.saddingtonbaynes.com

http://www.smashingmagazine.com/2008/04/25/free-credit-card-icons-for-online-shops/

Technical:

http://www.smashingmagazine.com/2008/04/15/60-more-ajax-and-javascript-solutions-for-professional-coding/

http://blogs.zdnet.com/microsoft/?p=1355

http://blogs.zdnet.com/Stewart/?p=821

Stuff:

http://www.muxtape.com/ 

test

ModalPopupExtender & The MasterPage : One ModalPopup to bind them all

By tim

Hi

I came up with this solution a while back.  I had a GridView which i needed to display a kind of Master/Detail scenario.  I decided to use the ModalPopupextender as it forces the user to do stuff or cancel before the rest of the page executes and the ModalPopup seemed perfect.  however, having too many on the form is a bit wasteful so i went about exploring having only 1 ModalPopupExtender for my entire application and having all pages which needed it just add their stuff to it and pop it themselves, wiring up the OK and Cancel events to something both the MasterPage and the ContentPage could have access to.

It's a bit long winded to post but i attach the files here in response to a post on asp.net about a similar problem with a GridView having too many modal popups.  Feel free to post any suggestions here and i will try and update the code with any new features :¬)

You will need to add the AjaxControlToolkit.dll to the bin folder to get it working.  And it's written in Visual Studio 2008 so you might need to change the toolkit version if you're running asp.net AJAX version 1

cheers

Tim

ModalPopupTest.zip (5.03 kb)

Regular Expressions - Everyday use with System.Text.RegularExpressions.Regex.Replace()

By nat

I recently had to display some text on a page where the source field was fully marked up html, but I only wanted the content. I imagined a long drawn out process of doing a string.Replace() on all html tags, and was considering booking a holiday, when REGEX came to the rescue. It was so simple - much simpler than I ever thought it would be.

Using the expression "<.*?>" to match all html tags, i then called the System.Text.RegularExpressions.Regex.Replace() method, which is very similar to string.Replace, only you can pass a regular expression to replace only the matches, and voila - all the html markup is removed.

Simple now that I think of it, but before I had seen this used, this task seemed a real pain in the behind.

A couple of useful regex resources:
http://www.quanetic.com/regex.php - on online REGEX testing tool
http://www.regular-expressions.info/reference.html - REGEX reference site - from basic to complex, everything you need.

Hope this comes in handy...

Nat

SQL (TSQL)Tips & Tricks

By billy

Hi All,

Some great tips and tricks for SQL for ya'll.

DISTINCT & GROUP BY

http://www.sqlteam.com/article/how-to-use-group-by-with-distinct-aggregates-and-derived-tables

INNER JOIN - REMOVING DUPLICATES

(Within the INNER JOIN you can get the TOP 1 of a unique field and then use this to only return 1 from the koop up table, in this case Field1 and Field 2 can contain different values and therefore a DISTINCT will NOT work)

SELECT
TABLENAME.requiredField,
LOOKUPTABLENAME.Field1,
LOOKUPTABLENAME.Field2,
FROM TABLENAME
INNER JOIN LOOKUPTABLENAME ON LOOKUPTABLENAME.uniqueField = (SELECT TOP 1 uniqueField FROM LOOKUPTABLENAME WHERE LOOKUPTABLENAME .requiredField= TABLENAME.requiredField)
ORDER BY TABLENAME.requiredField

DUPLICATES

Also deleting duplicates ROWS from a table (need to :

DELETE FROM T1
FROM TABLENAME T1, TABLENAME T2
WHERE T1.dupField = T2.dupField
AND T1.uniqueField > T2.uniqueField

Hope they come in handy!

Laughing