Friday, 31 October 2008
Friday, 24 October 2008
Thursday, 23 October 2008
How do you programtically add a stylesheet link with .NET
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?
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
Tuesday, 14 October 2008
What is *.htc with CSS styling?
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
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" %>
InterfaceCreate 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.masterpublic partial class Parent : System.Web.UI.MasterPage, IMasterPage
{
public string hello { get; set; }
protected void Page_Load(object sender, EventArgs e)
{
hello = "Hello World!";
}
}
Wednesday, 8 October 2008
Monday, 6 October 2008
Change The Look of Gmail in Seconds
Wednesday, 1 October 2008
Scroll jump with easy to call JavaScript functions
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>