Determine if there are deltas/diffs Between Two Lists Of Same DataType

// Determine if there are unsaved changes
 var changedItems = from item1 in BoundJHAStaleNotifications
 from item2 in JHAStaleNotifications
 where item1.JHAStatus == item2.JHAStatus
 && item1.StaleUserType == item2.StaleUserType
 && ItemsAreDifferent(item1, item2)
 select item1;

 if (changedItems.Count() > 0)
 ((EHAP_MasterPage)Master).ErrorMessage = "There are unsaved changes on this tab. Please either Save or Cancel before proceeding.";

private bool ItemsAreDifferent(JHAStaleNotification item1, JHAStaleNotification item2)

 bool ItemsAreDifferent = (item1.JHAStatus == item2.JHAStatus &&
 item1.StaleUserType == item2.StaleUserType &&
 item1.EntityStateType == item2.EntityStateType &&
 item1.Frequency == item2.Frequency &&
 item1.SendNotification == item2.SendNotification &&
 item1.Threshold == item2.Threshold);

 return !ItemsAreDifferent;


How to Set Up SmartGit With GitHub

  1. Create a account
  2. Download GIT For Windows (msysgit) –>
  3. Install msysgit choosing the following options:  Use git bash only [default].   Checkout Style:   Choose:  “check out as is commit as is”
  4. Launch GIT GUI
  5. In GIT GUI click menuitem:  Help | Show SSH Key | Click Generate Key and enter a passphrase
  6. Confirm new RSA keys were created in C:\Users\YourUserName\.ssh
  7. Open C:\Users\YourUserName\.ssh\ with Notepad++ and copy to clipboard.
  8. Login to Github and navigate to your Account Settings | SSH public keys and Create a new key. Paste the contents of  your RSA public key you just copied.  Name it anything you want
  9. Download and Install SmartGIT –>
  10. Launch SmartGIT.  It should automatically find your rsa keys.
  11. Clone a project Project | Clone | Remote URL:  (or any other githum repo)
  12. If it asks for a password, use your password.

How To Easily Compare 2 Lists To Determine Differences

This will work with complex types too.

bool changesMade = ListOne.SequenceEqual(ListTwo);

Note this uses the default equality compare (Equals). You may need to override the equals.

 public override bool Equals(object obj)
            if (obj is JHAStaleNotification)
                JHAStaleNotification other = (JHAStaleNotification)obj;
                return (this.JHAStatus == other.JHAStatus && 
                    this.StaleUserType == other.StaleUserType &&
                    this.EntityStateType == other.EntityStateType &&
                    this.Frequency == other.Frequency &&
                    this.SendNotification == other.SendNotification &&
                    this.Threshold == other.Threshold);
                return false;

IE 8 Standard Mode vs Compatibility Mode

We had an issue where a menu dropdown was rendering differently on the dev server in contrast to what we had locally. After doing an exhaustive comparison of the css on local and on the dev server they were identical.

As it turns out IE8 has compatibility modes which allow the user to choose how the website will be rendered. You can acess this feature via: Tools | Compatibility View Settings. This feature is quite useful for sites that haven’t been updated to support more strict HTML standards. What is of interest to us is IE8 defaults to have all intranet sites put into “Compatibility View”. This explained why it rendered perfectly fine in IE8 locally but exhibited rendering issues once accessed on the dev server via the intranet.

We were able to fix this issue by adding the following meta tag to the head section of the MasterPage. This basically tells IE8 to render in Standard Mode. This has no effect on IE6 so things work as designed:

<%--This enforces IE8 standard mode since compatibility view throws off styling--%>    
    <meta http-equiv="X-UA-Compatible" content="IE=8" >

Edit: It appears that if the Intranet zone is configured to “Display intranet sites in Compatibility View” this solution above will not force the pages into IE8 Standards mode as the browser settings are overriding this.

To get around this you need to have a Group Policy set up.

Edit (01/16/2012) It appears you can get around this by adding the necessary property to the page header.

Adding the following to the base page class that all pages inherit from will ensure all pages render in IE8 standard mode (not compatibility mode) even if viewing from Intranet which defaults to compatibility mode.

Response.AddHeader("X-UA-Compatible", "IE=EmulateIE8"); 

More info

Using Generic ASP.NET ImageButton Having 3 Image States (normal,hover,down)

<asp:ImageButton ID="imgBtnFind" runat="server" OnClick="imgBtnFind_Click" ImageUrl="~/Modules/Logging/Images/find_on.png"
            CausesValidation="false" onmouseover="this.src='/Modules/Logging/Images/find_hover.png'"
            onmouseout="this.src='/Modules/Logging/Images/find_on.png'" onmousedown="this.src='/Modules/Logging/Images/find_click.png'" />