When you are sendind any response using "Response.Write(........)", then it may have some previous value.
try to clear it first and then ending it.
checkno = 0;
checkno = 1;
And you are good to go. :)