Using Javascript to disable a button in ASP.NET

How do we stop those trigger happy web users who feel the need to press buttons more than once. One way is to disable/change the button on the first click. All that is required is a couple of simple lines of code to make this happen. In my Page_Load event I have the following;

if (!IsPostBack)
{
    MyASPNetButton.Attributes.Add("onclick", "this.value='Please wait...'; this.disabled=true;" +      Page.ClientScript.GetPostBackEventReference(MyASPNetButton, "").ToString());
}

IE Compatibility View

Having done some intensive research over the last couple of days to define exactly what happens when you set your IE browser to Compatibility View I thought it was worth noting a few things down.

  • IE uses Compatibility View to let website developers/administrators define how a website is displayed regardless of the version of IE being used. This is because MS are moving away from their bespoke CSS implementations, used for < IE7, to the more recognised W3C version.
  • The Compatibility View also affects the level of support applied to JavaScript code as functionality will change between versions of IE.
  • By default, any IE user running in the Local Intranet Security zone is automatically forced into Compatibility View. However, this option can be changed either by a user with sufficient permissions or Group Policy.
  • There is no way to programmatically stop users from running the site in Compatibility View. Adding the <meta> tag correctly disables the option from the Tools menu but the site can still be forced into Compatibility View either by:
    • Using the default Compatibility View settings and running in the Local Intranet security zone
    • Adding the site to the Compatibility View settings (this is a separate option to the Compatibility View switch in the Tools menu).

These are some of the useful links I have found whilst scouring the web for relevant information:

Getting the Latitude and Longitude from Bing maps

Pinpoint an exact spot.
To get the Latitude and Longitude from Bing maps you should centre the map on your point of interest, then do either of the following:
  1. Type javascript:map.GetCenter() in the address bar of IE and then hit ENTER. Your map will change to a page containing the Latitude and Longitude.
  2. In Firefox, using Firebug go to the Script tab and the in the right hand (Watch) pane enter javascript:map.GetCenter() into the New Expression field and hit ENTER. (see below)