Anna Hawks

Anna Hawks

  • NA
  • 193
  • 0

IsNullorEmpty not recognizing Null Value

Jan 30 2008 11:07 AM
I am trying to prevent a person from editing a form once it has already been approved by checking the approved date within a formview with the IsNullOrEmpty method. However, it is registering as NOT null/empty regardless of what is in the SQL Data Source. Here is the code:
                if (!String.IsNullOrEmpty(frmChgRequest.FindControl("ApprovedDateLabel").ToString()))
                {
                    lblErrorMessage.Text = "This Request has already been approved and cannot be edited.";
                    e.Cancel = true;
                }

Since it is checking the Label in the Formview do I need to do this differently?

Thanks for your help!

Answers (6)