Rad combobox , get the current text for event onclientKeypressing

2 posts, 0 answers
  1. Ilyas Sapiyan
    Ilyas Sapiyan avatar
    4 posts
    Member since:
    Mar 2009

    Posted 27 Mar 2011 Link to this post

    Hi All ,

    I use the radcombobox and the event onkeypressing() ,when i type text on radcombobox i can't get the current text completely  ,
    Ex:
    i set Loadondemand=false ( i can't use this feature bcos everything must process on Client site)
    i want to get the whole text , that user has typed.
    And in this event i receive 2 parameters , sender  and eventArgs

    but i don't know how to get completely the text , it always miss latest characters,

    Pls help me .


  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 28 Mar 2011 Link to this post

    Hello Ilyas,

    You can use the setTimeout() to achieve the same. Here is a sample code.
    aspx:
      <telerik:RadComboBox ID="ddlDevelopmentArea" EnableLoadOnDemand="false" OnClientKeyPressing="OnClientKeyPressing" runat="server" AllowCustomText="true" HighlightTemplatedItems="true">
       <Items>
        <telerik:RadComboBoxItem Text=".........ChooseText........" Value="0" />
       </Items>
    </telerik:RadComboBox>

    JavaScript:
    <script type="text/javascript">
        var args1;
     function OnClientKeyPressing(sender, args)
      {
            args1 = args;
            setTimeout("getValue()", 2000);
      }
    function getValue()
      {
            alert(args1._domEvent.target.value);
      }
    </script>

    Check out the following article for more on this.
    JavaScript Timers with setTimeout and setInterval

    Thanks,
    Shinu.
Back to Top