Click here to Skip to main content
15,886,830 members

Comments by Predator008 (Top 10 by date)

Predator008 14-Sep-12 16:02pm View    
Could you plz explain that using a concrete example? thanks
Predator008 14-Sep-12 15:34pm View    
I m not using Forms at all I wanna go for Session or queryString to do this. Is it appropriate? or am I going to have a hard time going this way?
I m using a Master Page, I m thinking of using QueryString and check it in this master page and see whether the user is logged in or not? the querystring will be encrypted and contain the username, something like this
Predator008 12-Sep-12 10:14am View    
indeed it is client side validation, thanks anyway NothingToLoose and _Amy
Predator008 12-Sep-12 8:56am View    
I got it work, i still have just some minor problems in the execution of the ifs. here are the ifs i ve put in my logic:
protected void SearchButton_Click(object sender, EventArgs e)
{

BLL.EmpLNameValidate bl = new BLL.EmpLNameValidate();


if (!bl.RequiredLname(LNameText.Text))
{
Label1.Text = "Last Name is required!";
lblLnameValid.Visible = true;
EmpDataView.Visible = false;
}
else if(!bl.LenghtValidate(LNameText.Text))
{
Label1.Text = "Please enter at least 2 characters!";
lblLnameValid.Visible = true;
EmpDataView.Visible = false;
}
else if (!CharactersValidate(LNameText.Text))
{
Label1.Text = "Only alphabets are allowed!";
lblLnameValid.Visible = true;
EmpDataView.Visible = false;
}
else if (FNameText.Text.Length > 0 & !bl.LenghtValidate(FNameText.Text))
{
Label2.Text = "Please enter at least 2 characters!";
lblFnameValid.Visible = true;
EmpDataView.Visible = false;
}
else if (FNameText.Text.Length > 0 & !CharactersValidate(FNameText.Text))
{
Label2.Text = "Only alphabets are allowed!";
lblFnameValid.Visible = true;
EmpDataView.Visible = false;
}
else
{
lblLnameValid.Visible = false;
lblFnameValid.Visible = false;
Label1.Text = null;
Label2.Text = null;
BindData();

if (EmpDataView.Rows.Count == 0)
{

NewUserLabel.Visible = true;
NewUserButton.Visible = true;

}
else
{
EmpDataView.Visible = true;
NewUserLabel.Visible = false;
NewUserButton.Visible = false;
}

}
}

where my BLL file (Class) looks like this:

namespace Phonebook.BLL
{
// TODO Validate that the user have entred characters for Last Name field
public class EmpLNameValidate
{

// to validate last name is required
public bool RequiredLname(string txt)
{
if (!string.IsNullOrEmpty(txt))
{
return true;
}
else
{

return false;
}
}

// to validate 2 characters lenght
public bool LenghtValidate(string txt)
{
if (txt.Length < 2)
{
return false;

}
else
{
return true;
}

}
}
}

i run it it's working but still some minor "inpurities" in the ifs.
Predator008 11-Sep-12 11:54am View    
I've done like you said before but it didn't work, maybe I am missing something or I misplaced the logic behind this.
thnks anyway Wes