asp.net mvc 4 - Unable to display a table properties through Jquery UI Autocomplete -
this controller.
public class homecontroller : controller { string commstring = ""; public homecontroller() { fwutility.connstring = "data source = developer1; initial catalog = fr8demodb; uid=sa; pwd=123;"; } public actionresult index() { return view(); } public actionresult fillautocomplete() { commstring = "select brandid, brandname brandmaster order brandname"; list<brandmaster> listbrandmaster = fwutility.getlist<brandmaster>(fwutility.getdatatable(commstring)); return json(listbrandmaster, jsonrequestbehavior.allowget); } } public class brandmaster { public string brandid { get; set; } public string brandname { get; set; } } }
this view.
@using system.data; @using jqeryuiautocompleteonclickdisplaybrandidofbrandname.controllers; @model string <script type="text/javascript"> $(document).ready(function () { $.ajax({ url: 'home/fillautocomplete', type: 'post', datatype: 'json', success: function (data) { $("#tags").autocomplete({ source: eval(data) }); }, error: function () { alert('error'); } }); }); </script> <body> <div> <input id="tags"> </div> </body>
auto-complete getting displayed values "brandmaster" table "brandnames" not showing. trying not happening. please help. query.stack-overflow displaying write more added last line.
Comments
Post a Comment