I am trying to implement an autoCompleteExtender into my project. Currently I am using the OnClientItemSelected property to call a javascript on the client side. Is there a way (using another property or some other code) that will let me call a method in the code behind when the user selects an option?
ajaxToolKit autoCompleteExtender OnClientItemSelected
7.9k views Asked by theNoobProgrammer At
2
There are 2 answers
0
Bhavin Mistry
On
For this you need to return the list from web service method with ID and Text
Here "lst" is the actual list with data from your data source.
List<string> items = new List<string>(count);
for (int i = 0; i < lst.Count; i++)
{
string str =AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(lst[i].Text,Convert.ToString(lst[i].IDValue));
items.Add(str);
}
return items.ToArray();
Then simple javascript
function GetID(source, eventArgs )
{
var HdnKey = eventArgs.get_value();
document.getElementById('<%=hdnID.ClientID %>').value = HdnKey;
}
and dont forget to set the attribute in auto complete extender OnClientItemSelected="GetID"
Related Questions in JAVASCRIPT
- Angular Show All When No Filter Is Supplied
- Why does a function show up as not defined
- I count the time the user takes to solve my quiz using Javascript but I want the same time displayed on another page
- Set "More" "Less" font size
- Using pagination on a table in AngularJS
- How to sort these using Javascript or Jquery Most effectively
- how to fill out the table with next values in array with one button
- State with different subviews
- Ajax jQuery firing multiple time display event for the same result
- Getting and passing MVC Model data to AngularJS controller
- Disable variable in eval
- javascript nested loops waiting for user input
- .hover() seems to overwrite .click()
- How to sort a multi-dimensional array by the second array in descending order?
- How do I find the fonts that are not loading in a CORS situation ( MoovWeb )?
Related Questions in ASP.NET
- Create an IIS web request activity light
- Writing/Overwriting to specific XML file from ASP.NET code behind
- What is the point of definnig Asp.net Intrinsic Objects In different places and what is the different betwen them?
- Deleting Orphans with Fluent NHibernate
- IOrderedEnumerable to vb.net IOrderedEnumerable Conversion
- Entity Framework Code First with Fluent API Concurrency `DbUpdateConcurrencyException` Not Raising
- Getting deeply embedded XML element values
- What is best way to check if any of the property of object is null or empty?
- NuGet - Given a type name or a DLL, how can I find the NuGet package?
- ASP-MVC Code-first migrations checkbox not active
- How do i add onclient click to my jquery button
- Jquery: Change contents of <select> tag dynamically
- Retrieving data from Oracle database
- ASP.NET: Fill Textbox field upon dropdownlist selection by user
- Why web API return 404 when deploy to IIS
Related Questions in CODE-BEHIND
- Getting selected items from a listbox using the index instead of value
- How to get value of textbox in code-behind which was set by Javascript?
- Generating an aspx <div> content from C# code behind
- Most efficient way of writing multi-select data to a SQL Server backend
- Capturing user response using Javascript confirm message from codebehind
- How would I pass a blob file from Javascript to server code behind in ASP.net
- WPF. Change DataContext on event binding to access code-behind on a MVVM project
- Having trouble with paging in asp repeater
- How to store a Dictionary in a ASP.NET hidden field value?
- Changing the ContentStringFormat property of a Label in code behind
- Sorting using a Repeater with pagination
- Add ValidationRule in XAML from code behind
- How to write a method to open an image in C# that will use the default image viewer on a mobile device...?
- UWP: ListView ItemClick not work
- How to get access to controls from CB when using hub - Windows Phone 8.1
Related Questions in AUTOCOMPLETEEXTENDER
- Add Scrollbar in AutoCompleteExtender in ASP.NET 4.5
- Asp.net autocomplete Extender not working
- Display two different values from different columns of same row in autocoompleteextender
- Calling TextChanged Event using Javascript
- Validate AutoCompleteExtender
- Ajax AutoComplete Extender with contextKey
- How to fill gridview with result from autocompleteextender
- AJAX AutoCompleteextender without webservice
- why AutoComplete Extender work very slow ASP.NET
- using autocompleteextender without webservice
- Warning AjaxControlToolkit.AutoCompleteExtender.CompletionListElementID is obsolete: Instead of passing in CompletionListElementID, use the default
- AjaxControlToolkit AutoCompleteExtender not working in IIS
- Is there a max limit a autocomplete extender can have?
- ASP.NET AutoCompleteExtender CompletionListCssClass
- Register OnClientItemSelected for a Dynamic AutoCompleteExtender
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
On server side handle
TextChangedevent of extended textbox.