We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How can I get the id of the first item by pressing Enter?

Thread ID:





150959 Jan 25,2020 05:51 PM UTC Jan 28,2020 06:30 AM UTC Blazor 3
Tags: AutoComplete
Marcelo Oliveira Santos
Asked On January 25, 2020 05:51 PM UTC

How can I get the id of the first item by pressing Enter?
a1 (id 0)
a2 (id 1)
a3 (id 2)
b1 (id 3)
b2 (id 4)
b3 (id 5)

Pressing B is shown:

Pressing Enter would get:

Sureshkumar P [Syncfusion]
Replied On January 27, 2020 09:56 AM UTC

Hi Marcelo, 
Greetings from Syncfusion support. 
You can get the filtered value in the actioncomplete event and store it in the global variable. So, when you press the enter key you can get the first value as mentioned below code snippet, 
public void keydown(KeyboardEventArgs args) 
    if(args.Code == "Enter") 
public Countries value { get; set; } 
public void onActionComplete(ActionCompleteEventArgs args) 
    value =  Newtonsoft.Json.JsonConvert.DeserializeObject<List<Countries>>(args.Result.ToString()).ToList<Countries>().FirstOrDefault(); 
We have created a sample based on your requirement. please find the sample here: https://www.syncfusion.com/downloads/support/directtrac/general/ze/KeyDownGetValue-1521680672  
Sureshkumar P 

Marcelo Oliveira Santos
Replied On January 27, 2020 07:10 PM UTC

Thanks Sureshkumar P, it works perfectly.


Sureshkumar P [Syncfusion]
Replied On January 28, 2020 06:30 AM UTC

Hi Marcelo, 
Sureshkumar P 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon