CEPIA - Cancer care pathway solutions i5 - rapid e-business development Dataline Software
  Welcome, Guest. Please Login or Register
Dataline Software - www.dataline.co.uk
 
Welcome to the Dataline Forum.
  Home Help  
 
Page Index Toggle Pages: 1
Setting LastError on page in business logic (Read 563 times)
Mark
i5 Group
*
Offline



Posts: 3
Setting LastError on page in business logic
03/01/10 at 22:16:48
 
I have an issue with error reporting ... dont know how to work around

SubmitLast doesn't show error popup


My code is as follows (formContainer is always the page):
Code:

if (formContainer.LastError.Text == "" && formContainer.LastError.Code == 0)
{
if (connection.LastError.Text == "")
        {
formContainer.LastError.Code = 0;
formContainer.LastError.From = ErrorSource.Application;
                formContainer.LastError.Text = ex.Message;
}
        else
        {
        formContainer.LastError = connection.LastError;
}
}


I have tried just throwing an exception instead of the above code - but that doesn't work either.

Any ideas? What could be happening?
Back to top
 
 
IP Logged
 
Mike Robinson
Global Moderators
*****
Offline



Posts: 120
Re: Setting LastError on page in business logic
Reply #1 - 03/02/10 at 10:06:02
 
Hi Mark,

The answer is that the LastError property needs to be set to a new Error instance, rather than each individual property being set separately. Please see below for two examples of how it should work:

Visual Basic code sample
Code:
' #18126 - Setting LastError on top level container in business logic 
Public Sub pgTest_Create(page As ndxContainer)
    Dim error As New ndxError
    error.Code = 123
    error.Text = "Test error"
    error.From = ndErrorMail
    page.LastError = error
End Sub


C# code sample
Code:
// #18126 - Setting LastError on parent container in business logic
protected override void OnSubmitLast(Container container)
{
      base.OnSubmitLast(container);
      Error error = new Error();
      error.Code = 456;
      error.From = ErrorSource.Application;
      error.Text = "Test Error";
      container.Parent.LastError = error;
}


I hope this helps.

Cheers,
Mike.
Back to top
 

Mike Robinson
Dataline Software Ltd
Clarence House, 30-31 North Street, Brighton, BN1 1EB, UK

Tel: +44 (0)1273 324939
Fax: +44 (0)1273 205576
www: http://www.dataline.co.uk
WWW  
IP Logged
 
Page Index Toggle Pages: 1