Click here to Skip to main content
16,016,623 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more: , +
hi to all,
Here i want to set autocomplete dropdown/textbox in mvc5.
Here i used selectize bundle.
So Kindly help me

Here i used this code for autocomplete dropdown/textbox in layout.cshtml

SQL
$('#select-gear').selectize({
    sortField: 'text'
});


Above code is corect or not (or) i want to rechange the code kindly help me
Posted
Comments
Jameel VM 12-Aug-14 3:08am    
please post the complete code you had tried so far

Dear Member 10918227,

There are two ways

1. With help of Jquery and WebService or Web API.

or

2. Simply watch this video you learn very easily.

https://www.youtube.com/watch?v=quQgUNteWxY[^]

If this solution is perfect solution then select as answer.

Thank you.
manoj kalla
 
Share this answer
 
Comments
JOTHI KUMAR Member 10918227 13-Aug-14 1:39am    
Here i use this but no change can suggest another one
$('#<%=txtsearch.ClientID%>').autocomplete({
source: function (request, response) {
var s = document.getElementById('<%=txtsearch.ClientID%>').value
$.ajax({
url: "Default.aspx/GetAllCities",
dataType: "json",
data: "{'prefixText': '" + s + "'}",
contentType: "application/json; charset=utf-8",
type: "POST",
dataFilter: function (data) {
return data;
},
success: function (data) {
if (data.d.split(',').length > 9) {
$(".ui-autocomplete").css("height", "200px");
}
else {
$(".ui-autocomplete").css("height", "auto");
}
response(data.d.split(','));
},
});
},

select: function (e, ui) {
var sname = ui.item.value;
}
});
 
Share this answer
 
Comments
JOTHI KUMAR Member 10918227 13-Aug-14 1:37am    
above solution what i refer can explain me please
Manoj B. Kalla 13-Aug-14 2:21am    
Can you explain again in detail? please. About your Model,view ,controller. What is and how to do any mendatory things involve in this (means any fix pattern guided to you).
JOTHI KUMAR Member 10918227 13-Aug-14 6:17am    
hi manoj i want to search autocomplete filter.i nedd the code for it. here i finished searching in my project now i want to search autocomplte for respective record shown in dropdown like google search or tell code to write auto complete

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900