Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1002937
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T07:54:03+00:00 2026-05-16T07:54:03+00:00

I’m working on an application where the validation (ranges) checks are controlled in the

  • 0

I’m working on an application where the validation (ranges) checks are controlled in the business logic layer. The code looks similar to this:

public string ValidateRange(int value, int lowRange, int highRange, string fieldDesc, System.Web.UI.WebControls.TextBox txtBox)
{
     string msg = "";

     if (value >= lowRange & value <= highRange)
         msg = "";
     else
     {
         msg = "Please enter a value between " + lowRange + " and " + highRange + " for \"" + fieldDesc + ".\"";
         txtBox.Focus();
     }

     return msg;
}

I’m pretty sure I’m doing this incorrectly so I was hoping someone can explain to me the most efficient way of handling the function and BLL so that it can pass to the Presentation layer nicely. My hope is that I can limit my interaction with the BLL to ValidateRange checks on the form’s TextBox controls with a return for each. If I’m approaching this incorrectly, please let me know. If it does work this way, how can I allow the BLL to access the TextBoxes from the Presentation Layer?

Thanks for your help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T07:54:03+00:00Added an answer on May 16, 2026 at 7:54 am

    I wouldn’t try to have the BLL mess with textboxes or anything that is presentation related. Afterall, the BLL is supposed to be presentation agnostic. Otherwise, should you need to write, say, a Windows Forms presentation layer (to go with your ASP.NET one), you’d have to re-write or add all new methods on your BLL to support accepting System.Windows.Forms.TextBox as well! It defeats the whole purpose of n-tier if the two presentation layers cannot share the same BLL methods/code.

    No, you’ll want to remove any traces of textboxes and such from the BLL and instead write code for auto-focusing invalid textboxes in the presentation layer itself.

    If you are using ASP.NET’s built-in validation stuff (Page.IsValid and CausesValidation and the like), you’ll just have to resort to checking which validator came back false and set the focus that way. You can still have your BLL provide the error message.

    For example, using a CustomValidator, you could have it call your BLL method ValidateRange. If the return value is String.Empty, return true (valid). If it is non-empty/non-null, you know you got an error, so set the CustomValidator’s ErrorMessage and/or Text properties to the string returned and then return false (invalid).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I would like to run a str_replace or preg_replace which looks for certain words
I know there's a lot of other questions out there that deal with this
public static bool CheckLogin(string Username, string Password, bool AutoLogin) { bool LoginSuccessful; // Trim

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.