How do I pass list of objects and string back to server?
Please look at the my code. It tried to debug, it never get back to server. it throws error :
Possibly unhandled rejection: obj' is not supported for deserialization of an array
What I have tried:
<tr ng-repeat="r in Students">
<td>{{::r.Name}}</td>
<td>{{::r.Class}}</td>
</tr>
<pre><asp:TextBox ID="fnBox" runat="server" class="form-control" placeholder="file name" ng-model="xlfileName"></asp:TextBox>
<input type="button" value="SendFile" ng-click="SendFile(Students)" />
angularJs:
$scope.SendFile = function (Data) {
var dataArray = [];
dataArray.push(Data);
dataArray.push($scope.xlfileName);
debugger;
$http({
method: "POST",
url: "StudentList.aspx/GetStudent",
data: { dataList:dataArray},
contentType: "application/json",
dataType: "json"
}).then(function (response) {
debugger;
console.log(response);
});
}
public static string GetStudent(List<DemoList> dataList)
{
}
public class DemoList
{
public List<Student> students { get; set; }
public string Fn { get; set; }
}