BindingErrors

Web Connection supports the concept of binding errors when using the Databind() and Unbind() methods of the Page class. These methods cause a set of BindingErrors to be set on the page's BindingErrors collection.

Two classes control binding errors:

  • BindingError
  • BindingErrorCollection

You'll be interacting mostly with the BindingError collection as a whole most likely as in code as the following:

FUNCTION btnSubmitForm_Click()

this.UnbindData()

IF this.BindingErrors.Count > 0
   *** Display on the Error Display control
   this.ErrorDisplay.ShowError(this.BindingErrors.ToHtml(),"Please correct the following")
   RETURN
ENDIF

*** Validate Business Rules
IF !THIS.oDeveloper.Validate()
   this.AddValidationErrorsToBindingErrors(THIS.oDeveloper.oValidationErrors)
   this.ErrorDisplay.ShowError(this.BindingErrors.ToHtml(),"Please correct the following")
   RETURN
ENDIF

*** Finally save
IF !THIS.oDeveloper.Save()
   this.ErrorDisplay.ShowError("Save Error: " + THIS.oDeveloper.cErrorMsg
ELSE
   this.ErrorDisplay.ShowMessage( "Entry Saved" )
ENDIF    

ENDFUNC

© West Wind Technologies, 1996-2019 • Updated: 12/24/12
Comment or report problem with topic