Yes, My problem is solved. Here is the solution.
<input type="hidden" id="hdnAjax" value="0" />
<asp:button id="btnNext2" runat="server" onclientclick="return callAfterTime();" onclick="imbNext2_Click" xmlns:asp="#unknown" />
<div style="display: none;">
<asp:imagebutton id="btnNextSubmit" runat="server" onclick="imbNext2_Click" xmlns:asp="#unknown" />
</div>
I have put a hidden variable and a hidden button on aspx page.
No in js file:
<script type="text/javascript">
function validate()
{
if (document.getElementById('hdnAjax').value == '0') {
InputPromoCode();
setTimeout('validate();', 500);
return false;
}
if(document.getElementById('ctl00_generalContent_hdnStatus').value=='')
return false;
else
{
document.getElementById('ctl00_generalContent_btnNextSubmit').click();
return true;
}
}
var t;
function timedCount()
{
t=setTimeout("validate()",1000);
document.getElementById('ctl00_generalContent_hdnData').value="1";
}
function callAfterTime()
{
stopCount()
return timedCount();
}
function stopCount()
{
clearTimeout(t);
}
</script>