View state? Are you saying that there should be postbacks anywhere between these three clicks? If so, storing the number of clicks in Javascript (normally quite possible) would be useless, as after the postback the Javascript state machine for the page is fully reset, created from scratch. In this case, the use of viewstate variable would be quite an adequate way of working around, which is quite easy: just store then number is some view state variable and update in the server-side click handler Please see:
http://msdn.microsoft.com/en-us/library/ms972976.aspx[
^],
http://msdn.microsoft.com/en-us/library/ms228048%28v=vs.85%29.aspx[
^],
http://msdn.microsoft.com/en-us/library/ms227551%28v=vs.85%29.aspx[
^].
However, if there are no postbacks during all the click, you can use Javascript and client side along, as it supports the
closure functionality:
http://en.wikipedia.org/wiki/Closure_%28computer_science%29[
^].
Say, you can work with some event handler like this:
clickLimit = 3;
var clickCount = 0;
function ClickHandler() {
if (clickCount > clickLimit) {
}
++clickCount;
}
—SA