Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery Autocomplete not working inside ASP.NET MVC View Dynamically Loaded
    primarykey
    data
    text
    <p>I'm loading an ASP.NET MVC 3 View dynamically. Inside a view, there is a Textbox that needs to have "automcomplete". Code below:</p> <pre><code>@model CountryViewModel @using (Html.BeginForm("Create", "Country", FormMethod.Post)) { @Html.ValidationSummary(true) &lt;div class="field"&gt; @Html.LabelFor(model =&gt; model.Name) @Html.TextBoxFor(model =&gt; model.Name) @Html.ValidationMessageFor(model =&gt; model.Name) &lt;/div&gt; &lt;div class="field"&gt; @Html.LabelFor(model =&gt; model.Description) @Html.TextBoxFor(model =&gt; model.Description) &lt;/div&gt; &lt;div class="field"&gt; @Html.LabelFor(model =&gt; model.Latitude) @Html.TextBoxFor(model =&gt; model.Latitude) &lt;/div&gt; &lt;div class="field"&gt; @Html.LabelFor(model =&gt; model.Longitude) @Html.TextBoxFor(model =&gt; model.Longitude) &lt;/div&gt; @Html.HiddenFor(model =&gt; model.CultureId, new { id = "CultureId" }) } &lt;script type="text/javascript"&gt; $(document).ready(function () { $('#Name').autocomplete({ source: function(request, response) { $.ajax({ url: '@(Url.Action("GetCountriesB", "Country"))', data: "{ 'countryName': '" + request.term + "' }", dataType: "json", type: "POST", contentType: "application/json; charset=utf-8", dataFilter: function(data) { return data; }, success: function(data) { response($.map(data.d, function(item) { return { value: item.Country } })) }, error: function(XMLHttpRequest, textStatus, errorThrown) { alert(textStatus); } }); }, minLength: 2, focus: function( event, ui ) { $( '#Name' ).val( ui.item.Country ); return false; } }); }); </code></pre> <p></p> <p>I am loading this View inside a jQuery UI Dialog. When I debug using Firebug, the "script" tag seems not be loaded, hence autocomplete is not working.</p> <p>Any idea why this behavior?</p> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload