bool lozinka()
{
int r = GridView1.Rows.Count;
for (int i = 0; i < r; i++)
{
if(DropDownList1.SelectedItem.Value==GridView1.Rows[i].Cells[2].Text)
if (TextBox2.Text == GridView1.Rows[i].Cells[3].Text)
{
id = GridView1.Rows[i].Cells[2].Text;
p = Convert.ToInt32(id);
exit;
}
}
return false;
}
protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args)
{
if (lozinka())
args.IsValid = true;
else
args.IsValid = false;
}
//这是我尝试检查密码时出错的代码?当我尝试登录时,这是用户名和密码的自定义验证器
答案 0 :(得分:1)
试试这个
p=convert.ToInt32(id);
return true
而不是退出!