I'm developing an interface using ASP.NET with AJAX Webforms. It shows an update panel upon initialization of the page and after various actions are requested to validate the user with a PIN number. The interface will be mostly used on tablets, so I created a keypad with buttons to collect the user's PIN number that looks something like this:
When the buttons are clicked they run:
protected void btn0_Click(object sender, EventArgs e)
{
AddNumberToPin("0");
}
The procedure they call with their labeled number as the argument strDigit
is defined as:
protected void AddNumberToPin(string strDigit)
{
txtPIN.Text += strDigit;
if (txtPIN.Text.Length == 5)
{
...
...check database to validate the pin
...
}
}
This works, however it is very slow because every button click creates another round trip to the web server. It seems like it should be simple to store the collected PIN in a local variable on the client and then only post to the server once the 5 digits have been collected. I'm new to web programming, so I'm not sure how to go about doing this.
I've read this and this, but I still can't figure out how to get the buttons to stop posting to the server. Is this possible?