@m7mdm3ode,i tried on textchange event it works for me,below is the sample code,
HTML:
<asp:TextBox runat="server" ID="txtblur" OnTextChanged="txtblur_TextChanged" AutoPostBack="true" onchange="texboxchange()"></asp:TextBox>
JavaSript
<script type="text/javascript">
function ShowProgress() {
setTimeout(function () {
var modal = $('<div />');
modal.addClass("modal");
$('body').append(modal);
var loading = $(".loading");
loading.show();
var top = Math.max($(window).height() / 2 - loading[0].offsetHeight / 2, 0);
var left = Math.max($(window).width() / 2 - loading[0].offsetWidth / 2, 0);
loading.css({ top: top, left: left });
},2);
}
function texboxchange() {
ShowProgress();
var txtBox = document.getElementById('<%= txtblur.ClientID %>');
var count = txtBox.value.length;
if (count == 2) {
document.getElementById('<%= txtblur.ClientID %>').focus();
return true; // this will call textbox changed event.
}
}
</script>
Codebehind c#:
protected void txtblur_TextChanged(object sender, EventArgs e)
{
System.Threading.Thread.Sleep(5000);
// txtblur.Focus();
txtblur.Text = "testing";
}