Sending a System.Data.DataSet to an Ajax.NET Professional method
I have added some small .NET object wrappers to the client-side JavaScript. As an example I have build a DataSet wrapper that you can use to submit a DataSet to the server using AJAX in the same way you are using DataSets on the server-side .NET code:
<script language="javascript">
var ds = new System.Data.DataSet("MyDataset");
var dt = new System.Data.DataTable("FirstTable");
// create the columns
dt.addColumn("FirstName", "System.String");
dt.addColumn("Alter", "System.Int32");
dt.addColumn("Datum", "System.DateTime");
dt.Rows.push({"FirstName":"Hans Werner","Alter":20,"Datum":new Date()});
dt.Rows.push({"FirstName":"Witzbold","Alter":333,"Datum":new Date(1977,4,20)});
// you can use a "row object", too
var r = new Object();
r.FirstName = "Michael";
r.Alter = 999;
r.Datum = new Date();
dt.Rows.push(r);
ds.Tables.push(dt); // add the DataTable to the DataSet ds
// add a second table to the DataSet
var dt2 = new System.Data.DataTable("SecondTable");
dt2.addColumn("FamilyName", "System.String");
dt2.Rows.push({"FamilyName":"Schwarz"});
ds.Tables.push(dt2);
// ...and submit the DataSet to the AJAX method
WebApplication1.DemoMethod1(ds);
</script>
1 Comment
Comments have been disabled for this content.
FcoGuerrero said
ohhhh!!!! Great!!!