I'd like this function to return a custom Javascript object, with the
parameters listed in the 'Add' calls. Using this method gives me the
error:

"Unable to cast object of 'System.String" to type
"AjaxPro.IJavaScriptObject."

Where am I going wrong here? Is it neccessary that I create a
serializable type with the properties I want?

<AjaxPro.AjaxMethod()> Public Function GetUserInformation(ByVal UserID
As String) As AjaxPro.JavaScriptObject

        Dim toReturn As New AjaxPro.JavaScriptObject

        Dim temp As New AjaxPro.JavaScriptString
        Dim da As New DataAccess()
        Dim ds As DataSet

        ds = da.getDataSet(SQL.General.EmployeeInfo(UserID))

        If ds.Tables.Count > 0 AndAlso ds.Tables(0).Rows.Count > 0 Then
            toReturn.Add("FirstName",
ds.Tables(0).Rows(0)("strFirstName").ToString())
            toReturn.Add("LastName",
ds.Tables(0).Rows(0)("strLastName").ToString())
            toReturn.Add("EmployeeCode", "0" &
ds.Tables(0).Rows(0)("intEmployeeID").ToString())
            toReturn.Add("NTLogin",
ds.Tables(0).Rows(0)("strNTLogin").ToString())
            toReturn.Add("Email",
ds.Tables(0).Rows(0)("strEmail").ToString())

            Return toReturn
        Else
            Return Nothing
        End If

    End Function


--~--~---------~--~----~------------~-------~--~----~
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