[thelist] [ASP.NET] best practice error handling

Richard Davey rich at launchcode.co.uk
Wed Apr 14 06:11:11 CDT 2004

Hello Les,

Wednesday, April 14, 2004, 11:55:49 AM, you wrote:

LL> A data layer method  GetProductSetID returns an ID string to a business
LL> method.
LL> The business method GetProdutSet uses the result to return a DataSet to
LL> the presentation layer.
LL> The presentation layer ProductSet.aspx.cs populates a DataRepeater with
LL> the returned DataSet.
LL> If, however, datalayer.GetProductSetID has an empty result set, it
LL> returns the string "No records match your search".
LL> How do I get this error string from within businesslayer.GetPSDetails
LL> (which should return a DataSet) to, say a label on the calling page?

The Presentation Layer, as its name implies, should be where you
handle this. The logic for deciding if you show/hide the dataset or a
"Sorry no data" layer should come at the point where you get the
values back from GetProductSet.

If it returns a string instead of a DataSet then just use the
layer.value attribute to set the layer text of your error message and
hide the dataset accordingly.

Best regards,
 Richard Davey

More information about the thelist mailing list