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 996257
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:50:56+00:00 2026-05-16T06:50:56+00:00

I can’t manage to get a proper json response in an asmx web service.

  • 0

I can’t manage to get a proper json response in an asmx web service. Data structure are defined with DataContract and DataMember attribute but specifying DataMember Name doesn’t change response data. Do you have any idea? Here the code (it’s for jqgrid):

    /// <summary>
        /// a row of the jquery table
        /// </summary>
        [DataContract()]
        public class RowElement
        {
            /// <summary>
            /// an Id for each row
            /// </summary>
            [DataMember(Name = "id")]
            public string Id { get; set; }

            /// <summary>
            /// the table of cells
            /// </summary>
            [DataMember(Name = "cell")]
            public string[] Cell { get; set; }
        }

        /// <summary>
        /// the table for jquery
        /// </summary>
        [DataContract()]
        public class MainGrid
        {
            /// <summary>
            /// the number of pages
            /// </summary>
            [DataMember(Name = "total")]
            public string Total { get; set; }

            /// <summary>
            /// the num of the actual Page?
            /// </summary>
            [DataMember(Name = "page")]
            public string Page { get; set; }

            /// <summary>
            /// nb of elements in all the table
            /// </summary>
            [DataMember(Name = "records")]
            public string Records { get; set; }

            /// <summary>
            /// the list of Rows
            /// </summary>
            [DataMember(Name = "rows")]
            public RowElement[] Rows { get; set; }
        }



    /// <summary>
            /// method for jquery
            /// </summary>
            /// <param name="numRows">nb of Rows</param>
            /// <param name="Page">nb of Page</param>
            /// <param name="sortField">the column for the sort</param>
            /// <param name="sortOrder">the order of the sort</param>
            /// <param name="searchString">the filter if defined</param>
            /// <returns>the grid returned</returns>
            [WebMethod]
            [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
            ////int Page, int pageSize, string sortIndex, string sortDirection
            public MainGrid jQGridDataASMX(int? numRows, int? page, string sortField, string sortOrder, string searchString)
            {

    ...
MainGrid mg = new MainGrid();
return mg;    
    }

Client side data is still Id and not id.

  • 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-16T06:50:57+00:00Added an answer on May 16, 2026 at 6:50 am

    I think i found why it doesn’t work. It’s because ScriptMethod will use JavascriptSerializer and not DataContractJSonSerializer. So i would have to migrate these service to wcf but when i read http://msdn.microsoft.com/en-us/library/bb412168.aspx i see than DataContractJSonSerializer is not JSON-friendly as they said…
    So if anyone has a solution to do what i try to do with JavascriptSerializer he is welcome.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can find why i get this error can someone help? package Android.data; public class
I am using jsonparser to parse data and images obtained from json response. When
Can I change the field public virtual ClassOne ClassOne { get; set; } to
Can any one tell, how to get the result of LINQ query contains group
I am using JSon response to parse title,date content and thumbnail images and place
Can MOSS integrate and get user profiles from multiple Active Directory and/or LDAP stores?
Can anyone tell me what i am doing wrong? I am trying to get
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
Can't get over it, no matter how much I search. I have AlarmManager, where
Can anyone let me know how can we change the value of kendo combobox

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.