Hi,
 
you have return more the one value using the Class.
 
ex.
This is _javascript_ function to pass two value location and Cliend code CBLoadName is a CallBack function
CSLoadData is a C# function.
AccCreditNote is AJAX class
function AddName(RowCount)
{
AccCreditNote.CSLoadData('Chennai','101',CBLoadName)
}

CallBack Function
-----------------
unction CBLoadName(res)
{
    var EltId;
    if(isError(res)) return;
    var retVal = res.value;
    EltId="SelName1"+rsCnt;
    var districtSelect = document.getElementById(EltId);
    districtSelect.options.length = retVal.ResultLength+1;
    for(var i=0;i<retVal.ResultLength;i++)
    {
        districtSelect.options[i].value = retVal.ID[i];
        districtSelect.options[i].text = retVal.Value[i];
    }
}
[AjaxPro.AjaxMethod()]
public AJAXSelectResult CSLoadData(string value,string value1)
{
 Ultra.DB.UltraDB AjaxDB = new Ultra.DB.UltraDB();
 AjaxDB.OpenConnection();
 AJAXSelectResult ajRes = new AJAXSelectResult();
 if (value=="Location")
 {
  strField="exec sp_accCrediteNoteAddCityQury";
  strTable="'"+value1+"'";
  MaxNumber1 objGeneral1 = new UltraDotNet.MaxNumbers.MaxNumber1(AjaxDB);
  DataSet ds=objGeneral1.GetResultFromQuery(strField,strTable);
  DataTable dtItem=ds.Tables[0];
  for ( int i =0;i<dtItem.Rows.Count;i++)
  {
    ajRes.AddItem(dtItem.Rows[i]["LocationCode"].ToString(), dtItem.Rows[i]["LocationCode"].ToString());
  }
 }
 AjaxDB.CloseConnection();
 AjaxDB = null;
 return ajRes;
}
[AjaxPro.AjaxClass()]
public class AJAXSelectResult
{
 public ArrayList ID;
 public ArrayList Value;
 public int ResultLength;
 public AJAXSelectResult()
 {
  ID = new ArrayList();
  Value = new ArrayList();
  ResultLength = 0;
 }
 public void AddItem(string nID, string sValue)
 {
  ID.Add(nID);
  Value.Add(sValue);
  ResultLength++;
 }
}



The other possible solution to my previous problem is to
return an array from my _callback method to the server and then back to
the client.

There HAS to be a way to do this. Could somebody please explain this?

clientMethod_callback(res) {

//code to get database data

return [val1, val1]; //so, at this point, 2 values are returned

}

clientMethod() {

var fromServer = namespace.class.serverMethod(clientMethod_callback);

return fromServer // the 2 values are lost and not returned here. can
somebody
// that knows what they are doing explain to
me how to keep
// returning the 2 values above so the can be
called on the client?

}

callingMethod() {

var arr1 = clientMethod()[1]; // alerting this gets 'undefined'
var arr2 = clientMethod()[2]; // alerting this gets 'undefined'

}

This would be a great help.

Thanks.



Love cheap thrills? Enjoy PC-to-Phone calls to 30+ countries for just 2ยข/min with Yahoo! Messenger with Voice.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ajax.NET Professional" group.

To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]

For more options, visit this group at http://groups.google.com/group/ajaxpro

The latest downloads of Ajax.NET Professional can be found at http://www.ajaxpro.info
-~----------~----~----~----~------~----~------~--~---

Reply via email to