views:

34

answers:

0

Hi...

I've got an entity object - Customer, with a property called VATRate. This VATRate is in the form of a decimal (0.25). I wanted to be able to enter a percentage value, and save it in the correct decimal value in the database, so I made this custom property:

partial class Customer{
    public decimal VatPercent {
          get{ ... //Get code works fine}

          set {
              this.VATRate = (value / 100);
          }
     }
}

And then I just bind this property instead of VATRate in my ASPX editTemplate (formview).

This actually works - at least one time, when I debug an update, the value is set correctly one time, and then right after it gets set to the old value. I can't really see why it sets the value twice (and with the old value the second time). Can anyone shed some light on this?