I have the following script code:
<
scriptlanguage="javascript"type="text/javascript"><!--
function
Button1_onclick() {ret = SimpleService.ReturnDataTable(
"fi","la","te", OnComplete, OnTimeOut, OnError);return
(true);}
function
OnComplete(arg) {document.getElementById(
'Text1').value = arg;//alert(arg);
}
function
OnTimeOut(arg) {alert("TimeOut encountered when calling Say Hello.");}
function
OnError(arg) {<
scriptlanguage="javascript"type="text/javascript"><!--
function
Button1_onclick() {ret = SimpleService.ReturnDataTable(
"fi","la","te", OnComplete, OnTimeOut, OnError);return
(true);}
function
OnComplete(arg) {document.getElementById(
'Text1').value = arg;}
function
OnTimeOut(arg) {alert("Error encountered when calling Say Hello.");}
function
OnError(arg) {alert(
"Error encountered when calling Say Hello.");}
// -->}
</script>
And this is the webservice method it calls:
publicDataSet ReturnDataTable(String Name,String Last,String Test){
DataSet ds =newDataSet();DataTable dt = ds.Tables.Add("RandomTable");DMStoDD dd =newDMStoDD();DataColumn column1 =newDataColumn();column1.ColumnName =
"Name";dt.Columns.Add(column1);
DataColumn column2 =newDataColumn();column2.ColumnName =
"Last";dt.Columns.Add(column2);
DataColumn column3 =newDataColumn();column3.ColumnName =
"Test";dt.Columns.Add(column3);
DataRow row;row = dt.NewRow();
row[
"Name"] = Name;dt.Rows.Add(row);
row = dt.NewRow();
row[
"Last"] = Last;dt.Rows.Add(row);
row = dt.NewRow();
row[
"Test"] = Test;dt.Rows.Add(row);
return ds;}
Is there something wrong with the way I'm calling my DataSet/DataTable?
Also, what properties does the client side object 'arg' have?
J
arg should have whatever properties are public on the server-side object (I believe) but only if you have a [ScriptService] attribute on the web service, and only if you have a jsonconverter defined for the data type. The default converter works pretty well for most data types, but seems to choke a bit on certain things. I've never done dataset/datatables (typically I roll my own collection for those applications) but from what I've read you can get a dataset converter if you use the Futures dll and make the appropriate changes to your web.config to suppor tit.
No comments:
Post a Comment