Hi, I think, that it is not possible to count number of tries on client side, because you can't check if login information is correct on client side. You need postback to do this. I think, that better idea is to store number of tries on server side using Session or maybe ViewState, but I'd prefer Session, because it is more secure (unless you are using ViewState encryption). But if you want to prevent user (Hacker?) from trying to login more than three times you should save number of tries in database associated with his IP adress, because if you store this in Session it is not problem to open new browser window and try anotrher three passwords...
// code in event handler on server side (asp.net)
int tries=0;
if (Session["logintries"]!=null) tries=(int)Session["logintries"];
if (tries<3)
{
// check password...
if (invalidPassword) tries++;
}
else
{
labelError.Text="No no no..";
}
Session["logintries"]=tries;
Tomáš Petříček (Microsoft C# MVP)
www.eeeksoft.net | Asp.Net Graphical controls