Add Awesome Controls Dynamically
I want to add awesome controls dynamically:
for example:
in view in have a table:
<table id="tbldynamicadd"></table>Auto Complete control:
@(Html.Awe().Autocomplete("Categories").Url(Url.Action("Getvalues", "AutoController")))download
function(){
$("#tbldynamicadd> tbody").html("");
$.ajax({
****ajax call***
},
success: function (data) {
for (i = 0; i < data.length; i++) {
var item = data[i];
var row = "<td align='center' > ****Want to add AutoComplete Control here**** </td>";
var newrow = $(row);
$("#tbldynamicadd").append(newrow);
}
}
});
}
warlok
asked
at 21 Mar 2016
Answers
-
this works in the demo:
<div id="test1"></div>
you could also set the name to something like #Name and use it as a format by calling in js str.replace('#Name', 'MealTest');
<script>
$(function () {
@{
var str = Json.Encode(Html.Awe().Autocomplete("MealTest").Controller("MealAutocomplete").ToString());
}
var str = @Html.Raw(str);
$('#test1').html(str);
});
</script>Omuanswered at 22 Mar 2016