Friday 31 October 2008

Test IE6 with IE7 installed

This software can help you out:

Tredosoft

Hope it helps!

Friday 24 October 2008

.netTiers

.netTiers is an open source code generation framework. It uses CodeSmith and is built on MS Application Blocks. Have a look here: .netTiers

Thursday 23 October 2008

How do you programtically add a stylesheet link with .NET

This is how you add a stylesheet link programatically:

HtmlLink newStyleSheet = new HtmlLink();

newStyleSheet.Href = "your.css";

newStyleSheet.Attributes.Add("type", "text/css");

newStyleSheet.Attributes.Add("rel", "stylesheet");

newStyleSheet.Attributes.Add("media", "screen");

Page.Header.Controls.Add(newStyleSheet);

Wednesday 22 October 2008

Multiple page life cycles for no reason?

Have you ever debug your ASP.NET code and noticed your breakpoint in the Page_Load event is hit multiple times, even though it should only execute once?

If you have any links with # as the navigation url this can happen as a request is sent each time to the server.

PSD to HTML

This is a great service that converts your PSD designs into strict XHTML with flow layout. Saves you the hassle: PSD2HTML

Tuesday 14 October 2008

What is *.htc with CSS styling?

IE also supports so called behaviors; .htc or .hta files that can be attached to specific elements using css making it possible to let these elements behave in a special way.

To read more and find examples have a look at this link:whatever:hover

Friday 10 October 2008

How to: Inherit master page events, methods, properties in a child master page

The easiest way to access events, methods, or properties on a parent master page within a child master page is to use an interface.

Master Pages

Create all common functionlity in a parent master page i.e. Parent.master

Now create your child master page i.e Child.master with it's master page set to Parent.master

<%@ Master Language="C#" MasterPageFile="Parent.master" AutoEventWireup="true" CodeFile="Child.master.cs" Inherits="Child" %>

Interface

Create an interface with a property/method/event you wish to set at parent level and access at child level.

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

namespace PageInterfaces

{

public interface IMasterPage

{

string hello { get; set; }

}

}

Child.master

public partial class Parent : System.Web.UI.MasterPage, IMasterPage

{

public string hello { get; set; }

protected void Page_Load(object sender, EventArgs e)

{

hello = "Hello World!";

}

}

Monday 6 October 2008

Change The Look of Gmail in Seconds

This is a brilliant Firefox plug-in for Gmail. Have a look here.

Wednesday 1 October 2008

Scroll jump with easy to call JavaScript functions

JavaScript file


var Glamour = {};
Glamour.scrollToErrorMessageInit = function(validationTriggerElementID, validationMessageElementID)
{
var validationTriggerElement = $get(validationTriggerElementID);
if (validationTriggerElement)
{
var validationMessageElement = $get(validationMessageElementID);
if (validationMessageElement)
{
validationTriggerElement.validationMessageElement = validationMessageElement;
$addHandler(validationTriggerElement, "click", Glamour.scrollToErrorMessageActivate);
}
}
};
Glamour.scrollToErrorMessageActivate = function()
{
if (this.validationMessageElement && this.validationMessageElement.style.display.length == 0)
{
// get the position of the element
var elementBounds = Sys.UI.DomElement.getBounds(this.validationMessageElement);
// scroll to the validation summary
window.scrollTo(0, elementBounds.y);
}
};

ASPX / HTML Call

<script type="text/javascript"/* >![CDATA[ */<%--// scroll to error message when client-side validation fails--%>Glamour.scrollToErrorMessageInit("<%= CompetitionSubmitButton.ClientID %>", "<%= EntryFormValidationMessage.ClientID %>");/* ]]> */</script>