Autocomplete does not appear in view, ASP.NET MVCCompile Views in ASP.NET MVCHow to render an ASP.NET MVC view as a string?How does JavaScript .prototype work?ASP.NET MVC - Set custom IIdentity or IPrincipalWhat does “use strict” do in JavaScript, and what is the reasoning behind it?Why does Google prepend while(1); to their JSON responses?File Upload ASP.NET MVC 3.0Why does ++[[]][+[]]+[+[]] return the string “10”?How does data binding work in AngularJS?Why does my JavaScript get a “No 'Access-Control-Allow-Origin' header is present on the requested resource” error when Postman does not?

What is going on with gets(stdin) on the site coderbyte?

I found an audio circuit and I built it just fine, but I find it a bit too quiet. How do I amplify the output so that it is a bit louder?

What is the English pronunciation of "pain au chocolat"?

What are some good ways to treat frozen vegetables such that they behave like fresh vegetables when stir frying them?

Does an advisor owe his/her student anything? Will an advisor keep a PhD student only out of pity?

When were female captains banned from Starfleet?

How does electrical safety system work on ISS?

Did the UK lift the requirement for registering SIM cards?

Why Shazam when there is already Superman?

What (the heck) is a Super Worm Equinox Moon?

How can I, as DM, avoid the Conga Line of Death occurring when implementing some form of flanking rule?

Shouldn’t conservatives embrace universal basic income?

Which was the first story featuring espers?

awk assign to multiple variables at once

Why does Carol not get rid of the Kree symbol on her suit when she changes its colours?

Biological Blimps: Propulsion

What to do when eye contact makes your coworker uncomfortable?

What does Apple's new App Store requirement mean

Why does AES have exactly 10 rounds for a 128-bit key, 12 for 192 bits and 14 for a 256-bit key size?

What fields between the rationals and the reals allow a good notion of 2D distance?

"It doesn't matter" or "it won't matter"?

What features enable the Su-25 Frogfoot to operate with such a wide variety of fuels?

A Trivial Diagnosis

Mimic lecturing on blackboard, facing audience



Autocomplete does not appear in view, ASP.NET MVC


Compile Views in ASP.NET MVCHow to render an ASP.NET MVC view as a string?How does JavaScript .prototype work?ASP.NET MVC - Set custom IIdentity or IPrincipalWhat does “use strict” do in JavaScript, and what is the reasoning behind it?Why does Google prepend while(1); to their JSON responses?File Upload ASP.NET MVC 3.0Why does ++[[]][+[]]+[+[]] return the string “10”?How does data binding work in AngularJS?Why does my JavaScript get a “No 'Access-Control-Allow-Origin' header is present on the requested resource” error when Postman does not?













0















I have one field in my view, it is a textbox field. But I'd like to change that field to an Autocomplete dropdown.



Below is my view:



@Html.TextBoxFor(model => model.SearchFilterPaymentCode, new @class = "form-control", @id = "searchInput1" )
@Html.HiddenFor(model => model.ID)

<script>
$(document).ready(function ()
$("#searchInput1").autocomplete(
source: function (request, response)
$.ajax(
url: '@Url.Action("getJenisPembayaran", "Payment1")',
dataType: "json",
data:
term: request.term
,
success: function (data)
response($.map(data, function (val, item)
return
label: val.Name,
value: val.Name,
ID: val.ID

))

)
,
select: function (event, ui)
$("#ID").val(ui.item.ID);
$("#SearchFilterPaymentCode").val(ui.item.label);

);
)
</script>


and below is my controller



public JsonResult getJenisPembayaran(string term)

var objCustomerlist = db.ParamJenisPembayarans.Where(x => x.Name.ToUpper()
.Contains(term.ToUpper()))
.Select(x => new ParamJenisPembayaranViewModel

ID = x.ID,
JenisPembayaran = x.Name
).Distinct().ToList();
return Json(objCustomerlist, JsonRequestBehavior.AllowGet);



When I debug the controller and fill the textbox with a few words, I get some data from the database, that means the controller is working well but the data does not appear in the view. What's wrong with my code?










share|improve this question
























  • which js library are you using?

    – Fatikhan Gasimov
    Mar 7 at 5:13












  • I'm using jquery @FatikhanGasimov

    – chaeusang chen
    Mar 7 at 6:18












  • Can you see a response for getJenisPembayaran in your dev console network tab?

    – Priyank Panchal
    Mar 7 at 6:48











  • I type getJenisPembayaran on console using chrome and get this error "Uncaught ReferenceError: getJenisPembayaran is not defined at <anonymous>:1:1" @PriyankPanchal

    – chaeusang chen
    Mar 7 at 7:18












  • Keep your devtools --> network tab open and try to use the autocomplete textbox. You will see it hitting your getJenisPembayaran method. Select that row and check the Response tab to see what you are receiving back from the server.

    – Priyank Panchal
    Mar 7 at 7:34















0















I have one field in my view, it is a textbox field. But I'd like to change that field to an Autocomplete dropdown.



Below is my view:



@Html.TextBoxFor(model => model.SearchFilterPaymentCode, new @class = "form-control", @id = "searchInput1" )
@Html.HiddenFor(model => model.ID)

<script>
$(document).ready(function ()
$("#searchInput1").autocomplete(
source: function (request, response)
$.ajax(
url: '@Url.Action("getJenisPembayaran", "Payment1")',
dataType: "json",
data:
term: request.term
,
success: function (data)
response($.map(data, function (val, item)
return
label: val.Name,
value: val.Name,
ID: val.ID

))

)
,
select: function (event, ui)
$("#ID").val(ui.item.ID);
$("#SearchFilterPaymentCode").val(ui.item.label);

);
)
</script>


and below is my controller



public JsonResult getJenisPembayaran(string term)

var objCustomerlist = db.ParamJenisPembayarans.Where(x => x.Name.ToUpper()
.Contains(term.ToUpper()))
.Select(x => new ParamJenisPembayaranViewModel

ID = x.ID,
JenisPembayaran = x.Name
).Distinct().ToList();
return Json(objCustomerlist, JsonRequestBehavior.AllowGet);



When I debug the controller and fill the textbox with a few words, I get some data from the database, that means the controller is working well but the data does not appear in the view. What's wrong with my code?










share|improve this question
























  • which js library are you using?

    – Fatikhan Gasimov
    Mar 7 at 5:13












  • I'm using jquery @FatikhanGasimov

    – chaeusang chen
    Mar 7 at 6:18












  • Can you see a response for getJenisPembayaran in your dev console network tab?

    – Priyank Panchal
    Mar 7 at 6:48











  • I type getJenisPembayaran on console using chrome and get this error "Uncaught ReferenceError: getJenisPembayaran is not defined at <anonymous>:1:1" @PriyankPanchal

    – chaeusang chen
    Mar 7 at 7:18












  • Keep your devtools --> network tab open and try to use the autocomplete textbox. You will see it hitting your getJenisPembayaran method. Select that row and check the Response tab to see what you are receiving back from the server.

    – Priyank Panchal
    Mar 7 at 7:34













0












0








0


1






I have one field in my view, it is a textbox field. But I'd like to change that field to an Autocomplete dropdown.



Below is my view:



@Html.TextBoxFor(model => model.SearchFilterPaymentCode, new @class = "form-control", @id = "searchInput1" )
@Html.HiddenFor(model => model.ID)

<script>
$(document).ready(function ()
$("#searchInput1").autocomplete(
source: function (request, response)
$.ajax(
url: '@Url.Action("getJenisPembayaran", "Payment1")',
dataType: "json",
data:
term: request.term
,
success: function (data)
response($.map(data, function (val, item)
return
label: val.Name,
value: val.Name,
ID: val.ID

))

)
,
select: function (event, ui)
$("#ID").val(ui.item.ID);
$("#SearchFilterPaymentCode").val(ui.item.label);

);
)
</script>


and below is my controller



public JsonResult getJenisPembayaran(string term)

var objCustomerlist = db.ParamJenisPembayarans.Where(x => x.Name.ToUpper()
.Contains(term.ToUpper()))
.Select(x => new ParamJenisPembayaranViewModel

ID = x.ID,
JenisPembayaran = x.Name
).Distinct().ToList();
return Json(objCustomerlist, JsonRequestBehavior.AllowGet);



When I debug the controller and fill the textbox with a few words, I get some data from the database, that means the controller is working well but the data does not appear in the view. What's wrong with my code?










share|improve this question
















I have one field in my view, it is a textbox field. But I'd like to change that field to an Autocomplete dropdown.



Below is my view:



@Html.TextBoxFor(model => model.SearchFilterPaymentCode, new @class = "form-control", @id = "searchInput1" )
@Html.HiddenFor(model => model.ID)

<script>
$(document).ready(function ()
$("#searchInput1").autocomplete(
source: function (request, response)
$.ajax(
url: '@Url.Action("getJenisPembayaran", "Payment1")',
dataType: "json",
data:
term: request.term
,
success: function (data)
response($.map(data, function (val, item)
return
label: val.Name,
value: val.Name,
ID: val.ID

))

)
,
select: function (event, ui)
$("#ID").val(ui.item.ID);
$("#SearchFilterPaymentCode").val(ui.item.label);

);
)
</script>


and below is my controller



public JsonResult getJenisPembayaran(string term)

var objCustomerlist = db.ParamJenisPembayarans.Where(x => x.Name.ToUpper()
.Contains(term.ToUpper()))
.Select(x => new ParamJenisPembayaranViewModel

ID = x.ID,
JenisPembayaran = x.Name
).Distinct().ToList();
return Json(objCustomerlist, JsonRequestBehavior.AllowGet);



When I debug the controller and fill the textbox with a few words, I get some data from the database, that means the controller is working well but the data does not appear in the view. What's wrong with my code?







javascript jquery asp.net-mvc






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 7 at 5:54









Dale Burrell

3,39052655




3,39052655










asked Mar 7 at 4:48









chaeusang chenchaeusang chen

53




53












  • which js library are you using?

    – Fatikhan Gasimov
    Mar 7 at 5:13












  • I'm using jquery @FatikhanGasimov

    – chaeusang chen
    Mar 7 at 6:18












  • Can you see a response for getJenisPembayaran in your dev console network tab?

    – Priyank Panchal
    Mar 7 at 6:48











  • I type getJenisPembayaran on console using chrome and get this error "Uncaught ReferenceError: getJenisPembayaran is not defined at <anonymous>:1:1" @PriyankPanchal

    – chaeusang chen
    Mar 7 at 7:18












  • Keep your devtools --> network tab open and try to use the autocomplete textbox. You will see it hitting your getJenisPembayaran method. Select that row and check the Response tab to see what you are receiving back from the server.

    – Priyank Panchal
    Mar 7 at 7:34

















  • which js library are you using?

    – Fatikhan Gasimov
    Mar 7 at 5:13












  • I'm using jquery @FatikhanGasimov

    – chaeusang chen
    Mar 7 at 6:18












  • Can you see a response for getJenisPembayaran in your dev console network tab?

    – Priyank Panchal
    Mar 7 at 6:48











  • I type getJenisPembayaran on console using chrome and get this error "Uncaught ReferenceError: getJenisPembayaran is not defined at <anonymous>:1:1" @PriyankPanchal

    – chaeusang chen
    Mar 7 at 7:18












  • Keep your devtools --> network tab open and try to use the autocomplete textbox. You will see it hitting your getJenisPembayaran method. Select that row and check the Response tab to see what you are receiving back from the server.

    – Priyank Panchal
    Mar 7 at 7:34
















which js library are you using?

– Fatikhan Gasimov
Mar 7 at 5:13






which js library are you using?

– Fatikhan Gasimov
Mar 7 at 5:13














I'm using jquery @FatikhanGasimov

– chaeusang chen
Mar 7 at 6:18






I'm using jquery @FatikhanGasimov

– chaeusang chen
Mar 7 at 6:18














Can you see a response for getJenisPembayaran in your dev console network tab?

– Priyank Panchal
Mar 7 at 6:48





Can you see a response for getJenisPembayaran in your dev console network tab?

– Priyank Panchal
Mar 7 at 6:48













I type getJenisPembayaran on console using chrome and get this error "Uncaught ReferenceError: getJenisPembayaran is not defined at <anonymous>:1:1" @PriyankPanchal

– chaeusang chen
Mar 7 at 7:18






I type getJenisPembayaran on console using chrome and get this error "Uncaught ReferenceError: getJenisPembayaran is not defined at <anonymous>:1:1" @PriyankPanchal

– chaeusang chen
Mar 7 at 7:18














Keep your devtools --> network tab open and try to use the autocomplete textbox. You will see it hitting your getJenisPembayaran method. Select that row and check the Response tab to see what you are receiving back from the server.

– Priyank Panchal
Mar 7 at 7:34





Keep your devtools --> network tab open and try to use the autocomplete textbox. You will see it hitting your getJenisPembayaran method. Select that row and check the Response tab to see what you are receiving back from the server.

– Priyank Panchal
Mar 7 at 7:34












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55036287%2fautocomplete-does-not-appear-in-view-asp-net-mvc%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55036287%2fautocomplete-does-not-appear-in-view-asp-net-mvc%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Save data to MySQL database using ExtJS and PHP [closed]2019 Community Moderator ElectionHow can I prevent SQL injection in PHP?Which MySQL data type to use for storing boolean valuesPHP: Delete an element from an arrayHow do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?How to get a list of MySQL user accountsHow Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?

Compiling GNU Global with universal-ctags support Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Tags for Emacs: Relationship between etags, ebrowse, cscope, GNU Global and exuberant ctagsVim and Ctags tips and trickscscope or ctags why choose one over the other?scons and ctagsctags cannot open option file “.ctags”Adding tag scopes in universal-ctagsShould I use Universal-ctags?Universal ctags on WindowsHow do I install GNU Global with universal ctags support using Homebrew?Universal ctags with emacsHow to highlight ctags generated by Universal Ctags in Vim?

Add ONERROR event to image from jsp tldHow to add an image to a JPanel?Saving image from PHP URLHTML img scalingCheck if an image is loaded (no errors) with jQueryHow to force an <img> to take up width, even if the image is not loadedHow do I populate hidden form field with a value set in Spring ControllerStyling Raw elements Generated from JSP tagds with Jquery MobileLimit resizing of images with explicitly set width and height attributeserror TLD use in a jsp fileJsp tld files cannot be resolved