Hello, 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;
}
if at all possible, my goal would be to keep the ValidateInputs part of the BLL to calls to look like:
ValidateRange(linqtable.FIELD, 1, 5, FIELD_DESC, FIELD)
Is there a way to pass access to all of a page's TextBox (or all controls in general) controls to the business logic layer?
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.