Note that there are some explanatory texts on larger screens.

plurals
  1. POpassing json object to view and displaying in slickgrid
    primarykey
    data
    text
    <p>The other posts on this topic have helped me but not completely. I am retrieving data from a Wcf service (included in my MVC 4 project) like this:</p> <p>WarehouseController.cs</p> <pre><code>WarehouseInput objWI = new WarehouseInput(); public ActionResult Index(WarehouseInput value) { objWI.count = 15; objWI.offset = 0; objWI.query = ""; objWI.sort = "ID"; objWI.order = "asc"; objWI.ID = 0; objWI.RowID = 0; Service1 c = new Service1(); c.GetWarehouseList(objWI); //var model = c.GetServices(); update 1 -----&gt; return View(objWI); //return GetWarehouseList(objWI); update 2 -----&gt; //return Json(objWI, JsonRequestBehavior.AllowGet); } </code></pre> <p>I am getting the data in my Json object...</p> <p><img src="https://i.stack.imgur.com/R2Gys.png" alt="data fetched"></p> <p>Index.cshtml EDIT:</p> <pre><code> @model MvcApplication1.WS.DataContracts.WarehouseInput @{ ViewBag.Title = "Index"; } &lt;h2&gt;Index&lt;/h2&gt; &lt;script type="text/javascript"&gt; alert('0'); $.ajax({ url: '@Url.Action("Index")', type: 'GET', cache: false, success: function(resp) { alert(resp); if (resp.WarehouseResults != null) { var objTemp = resp.WarehouseResults; //var from = resp.offset, to = from + resp.WarehouseResults.length; //data.length = parseInt(resp.total); //for (var i = 0; i &lt; resp.WarehouseResults.length; i++) { // data[from + i] = resp.WarehouseResults[i]; // data[from + i].index = from + i; //} //$("#lblRows").html("&lt;b&gt;Total: " + resp.total + "&lt;/b&gt;"); //onDataLoaded.notify({ from: from, to: to }); } else { //i = indicators.pop(); //if (i != null) // i.fadeOut(); alert('Error loading the page'); } alert('1'); } }); alert('1.5'); var values = @Html.Raw(Json.Encode(Model.WarehouseResults)); var data = []; var grid; var validator; </code></pre> <p>The problem is that the control never goes to the cshtml. How do I pass the json object to the view (UI)? How do I display it in the slickgrid that I am using? EDIT: The javascript code needs to be revised, but first I have to get the control to reach there.</p>
    singulars
    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.
 

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