Tech
Forums
Jobs
Books
Events
Videos
Conference
Annual Conference
Bcrypt
Ai Conference
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Post
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
1
Reply
How to do Autocomplete Textbox in MVC2?
tvv
10 years ago
1k
Reply
<%= Html.TextBox("SearchString")%>
JQuery:
$(function () {
$("#SearchString").autocomplete({
source: "/JsonData/getData",
minLength: 1,
select: function (event, ui) {
if (ui.item) {
$("#SearchString").val(ui.item.value);
$("form").submit();}}});
})(jQuery);
i added
jquery-ui-1.8.11.js
and
jquery-ui-1.8.11.min.js
json:
public JsonResult getData(string searchstring)
{
var set = (from a in CMS.StudentRegistrations select a.RollNumber);
var namelist = set.Where(n => n.ToLower().StartsWith(searchstring.ToLower()));
return Json(namelist, JsonRequestBehavior.AllowGet);
}
autocomplete textbox is not working for me. any body say me the solution . VS2010,MVC 2 only i used. Thanks in advance
Post
Reset
Cancel
Answers (
1
)
Next Recommended Forum
my pop up in websity is not poping up up ,
mvc ajax request using jquery and knockouts