RadNumericTextBox postback as-you-type

2 posts, 0 answers
  1. Ravin
    Ravin avatar
    8 posts
    Member since:
    Dec 2012

    Posted 23 Jul 2013 Link to this post

    I'm implementing a search-as-you-type feature using RadNumericTextBox. What should happen is when the user pauses typing on the RadNumericTextBox for half a second, it should perform a postback and my search results should get refreshed. I can catch the OnKeyPress client event of RadNumericTextBox, but the problem is that textbox's internal numeric value does not get updated until the textbox goes out-of-focus. How can I make it do a postback with the updated value while the user is typing on the textbox?.

  2. Konstantin Dikov
    Konstantin Dikov avatar
    2126 posts

    Posted 25 Jul 2013 Link to this post

    Hello Ravin,

    Thank you for contacting us.

    In your case you could use the blur() function of the client-side RadTextBox object to force a postback.

    Here is an simple example on how you can force postback with time interval between KeyPress client-side event:
    <telerik:RadCodeBlock runat="server">
        <script language="javascript" type="text/javascript">
            var timer = null;
            function keyPressed(sender, args) {
                timer = setTimeout(function () {
                    var textBox = $find("<%=RadTextBox1.ClientID %>");
                }, 1500)
    <telerik:RadTextBox ID="RadTextBox1" runat="server" AutoPostBack="true" OnTextChanged="RadTextBox1_TextChanged">
        <ClientEvents OnKeyPress="keyPressed" />

    Then on the server-side TextChanged event you may set the focus back to true:
    protected void RadTextBox1_TextChanged(object sender, EventArgs e)
         //your search logic

    Hope this helps.


    Konstantin Dikov
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Back to Top