Sie Ste

Sie Ste

  • NA
  • 196
  • 184k

web app comparison is not correct

Jun 25 2012 12:50 AM

In a C# 2010 web form that uses a formview control, I am comparing 2  dictionary objects to see if their values are different, right before the actual change occurs in the database. The code is comparing the old dictionary value to the new dictionary value to see if the value has changed. If so an 'invalid' date field is being set.

However the problem is the values are actually the same.  By stepping through the code, the application thinks the values are different. Can you tell  me what is wrong with the code listed below:

protected void FormView1_ItemUpdating(object sender, FormViewUpdateEventArgs e)
{    
           
                       
            if (e.NewValues["Cutoff_Date"] != e.OldValues["Cutoff_Date"])
          
            {
                e.NewValues["Invalid_Date"] = "Y";
            }

  }

Answers (1)