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

how to get RadAutoCompleteBox DataValueField value from javascript?

1 Answer 584 Views
AutoCompleteBox
This is a migrated thread and some comments may be shown as answers.
Ravi
Top achievements
Rank 1
Ravi asked on 10 Aug 2016, 11:35 AM

I am not getting the DataValueField from AutoCompleteBox using JAVASCRIPT.

I am getting the Text name of the field but not there ID/Value.\

i go thru various Telerik post ,i founf get_value() function but  when i am using it dosn't work.

suggest me the what can i do.

<p> function textChanged(sender, eventArgs) {</p>
alert("The text currently present in the input area of RadAutoCompleteBox is: " + eventArgs.get_text());<br>
 }

this textChanged function i put on

<telerik:RadAutoCompleteBox RenderMode="Lightweight" ID="txtPatient" runat="server" Filter="Contains" Width="100%"<br>InputType="Text" DataValueField="MTPatientID" DataTextField="Patient" EmptyMessage="Select Patient" WebServiceSettings-Method="BindAllpatient" MinFilterLength="4" OnClientTextChanged="textChanged"><br> <WebServiceSettings Method="GetCompanyNames" Path="QAFileProcess.aspx" /><br>                                <TextSettings SelectionMode="Single" /><br></telerik:RadAutoCompleteBox>

 

please suggest me how can i find the value.

1 Answer, 1 is accepted

Sort by
0
Nencho
Telerik team
answered on 15 Aug 2016, 07:09 AM
Hello Ravi,

In order to get the value of the given entry at this event, you need to get a reference to the Entry and then use the get_value() method:

<script>
           function textChanged(sender, eventArgs) {
               var value = sender.get_entries().getEntry(0).get_value();
               alert("The text currently present in the input area of RadAutoCompleteBox is: " + value);
           }
       </script>


Regards,
Nencho
Telerik by Progress
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
AutoCompleteBox
Asked by
Ravi
Top achievements
Rank 1
Answers by
Nencho
Telerik team
Share this question
or