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

1928 у кіно

Захаров Федір Захарович

Ель Греко