Wednesday, 15 July 2015

c# - Passing a DataTable object in Javascript to controller -


I have * .aspx pages, a call for a JavaScript function (which is defined elsewhere) That parameter as object ...

myPage.aspx

  & lt; Script type = "text / javascript" & gt; Buildtable ("Results / Table List /", "Tablet", {{:: Model.DataTable%>;}); RefreshTable (sortTable ["tbl-div_id"]); & Lt; / Script & gt;  

scripts.js

  // global var sortTable = {}; Function BuildTel (URL, Title, Algues) {var myTable = New Object (); MyTable.postBackUrl = url; MyTable.Title = Title; MyTable.args = (args! = Undefined)? Argus: new object (); Sortable [& lt; Index & gt;] = myTable; } Function sortable (selectedtable) {$. Ajax ({url: selectable post back url, data: selectedtable args, success: function .....}); } 

Parameters & gt; Datatale value). .. // `value` comes back to a new object, no colmns are defined,}

I can see in myPage.aspx column there And the rows are & lt;%: Model.DataTable% & gt; , but as soon as I go to the JavaScript debugger, I can not identify the object

Question

How do I make sure Can the ASPX page return javascript and javascript to the whole datatyall object on the server controller so that I can manipulate the prices?

UPDATE

If there is any way to go directly from the view to the controller, then I am also open for it

< P>

First of all, there is a typo at <%>: Model.DataTable%> It should be and lt;% = the model. DataTable% & gt; See if what else helps you that the object can be kept as a hidden element may be an input tag with an ID and pass that element to the javascript View the object with the help of document.getElementById (the ID of your hidden input) , if it helps.


No comments:

Post a Comment