Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 563125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T12:37:37+00:00 2026-05-13T12:37:37+00:00

I have an ASP.NET PageMethod with the following signature: <WebMethod()> _ Public Shared Function

  • 0

I have an ASP.NET PageMethod with the following signature:

<WebMethod()> _
Public Shared Function SaveCodes(ByVal codes As List(Of Code)) As String

I am trying to pass a JSON object to the PageMethod from the client side, but I get an error that the type String cannot be converted to type of List<Code>.

Here is the json that I’m building on the client and sending to the method:

{
‘codes’ : {
{ “companyID”: “00000000-0000-0000-0000-000000000000”, “customerType”:”1″, “code”:”11 ” },
{ “companyID”: “00000000-0000-0000-0000-000000000000”, “customerType”:”1″, “code”:”21 ” }
}
}

Here is my PageMethod call, (objects is the json string above):

PageMethods.SaveCodes(objects, successFn, errorFn);

I have been able to pass in simple data types and a single instance of the Code class, but I can’t seem to find the magic to pass a List to the server method. Can anyone show me what I’m doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T12:37:37+00:00Added an answer on May 13, 2026 at 12:37 pm

    I was able to figure it out. The correct notation is listed below. The main piece that was missing was the __type property for each object. I had to dig around in a List that was returned from a PageMethod to find that.

    {"codes":
    [  
    {"CompanyID":"00000000-0000-0000-0000-000000000000","Code":"11    ","CustomerType":"1","__type":"Code"},
    {"CompanyID":"00000000-0000-0000-0000-000000000000","Code":"21    ","CustomerType":"1","__type":"Code"}
    ]
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have asp.net generated html code. I want execute jQuery click function when user
I have the following JQuery code that worked perfect in C#/Asp.net 2.0 to call
I have ASP.Net code generating my button's HTML for me using divs to get
My Pagemethod implementation is not working in Chrome browser. I have ASP.NET 3.5 web
I have an ASP.Net-Button which, when clicked, executes client side and server side code.
I have asp.net application where string is created in following way. string abc; abc=vindo|vindo|vind?40|vind?40|vincent
I have asp.net mvc 3 site deployed on shared hosting. My problem is that
jQuery 1.3.2, ASP.NET 2.0. Making an AJAX call to a PageMethod (WebMethod) returns the
I have asp.net TextBox with ontextchanged event this is search text box in my
I have ASP.NET page with an iframe on it for displaying some pdf reports

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.