This is a migrated thread and some comments may be shown as answers.

Rad combobox , get the current text for event onclientKeypressing

1 Answer 117 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Ilyas Sapiyan
Top achievements
Rank 1
Ilyas Sapiyan asked on 27 Mar 2011, 09:46 AM
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 .


1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 28 Mar 2011, 06:56 AM
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.
Tags
ComboBox
Asked by
Ilyas Sapiyan
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or