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

  • Home
  • SEARCH
  • 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 7058085
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:04:14+00:00 2026-05-28T04:04:14+00:00

I just started working with jqGrid this week. I’m attempting to make a generic

  • 0

I just started working with jqGrid this week. I’m attempting to make a generic function that I can call to load a jqGrid with different postData parameters, defined in the function call.

Is there any way to do this? What I had considered was creating an array to store the parameter’s name/value, then setting that as a parameter in the postData. The web service would then go through and add those parameters to the SQL stored procedure call.

Here is the generic code:

var paramArray = new Array();
var p1 = new JQGridParam("CustomerName","John");
var p2 = new JQGridParam("ProductName","Kleenex");
var p3 = new JQGridParam("YearPurchased","2012");

paramArray[0] = p1;
paramArray[1] = p2;
paramArray[2] = p3;

$("#list").jqGrid({
     datatype: "json",
     url: "services/Customers.asmx/GetCustomerData",
     mtype: "POST",
     postData: {
         sqlParams: paramArray         //HERE IS WHERE I NEED THE HELP
     },
     ajaxGridOptions: { contentType: "application/json; charset=utf-8" },
     ajaxRowOptions: { contentType: "application/json; charset=utf-8" },
     serializeGridData: function (postData) {
                  return JSON.stringify(postData);
     },
     serializeRowData: function (postData) {
                  return JSON.stringify(postData);
     },
     jsonReader: {
         root: function (obj) { return obj.d.rows; },
         page: function (obj) { return obj.d.page; },
         total: function (obj) { return obj.d.total; },
         records: function (obj) { return obj.d.records; },
     },
     colModel: [
         {name: "CustID", index: "CustID" },
         {name: "PurchaseAmount", index: "PurchaseAmount" }],
     colNames: ["Customer ID", "Amount Purchased"],
     pager: $("#pager"),
     loadOnce: true,
     rowNum: 10,
     rowList: [10,25,50],
     gridview: true,
     viewrecords: true
});

When I try this, it throws the error “cannot convert object of type System.String to type System.Array”. Anyone have any ideas how to go about this?

  • 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-28T04:04:15+00:00Added an answer on May 28, 2026 at 4:04 am

    JSON stringify the array.

    JSON.stringify(paramArray);
    

    Then in your webservice cast the JSON data back to your object.

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

Sidebar

Related Questions

I just started working on a website that will help people understand what rappers
I just started working on an asp.net / C#.net application that is going to
I just started working with SSRS, so this question might seem silly. Anyway, for
I just started working on a new project and I can't set the build
I've just started working with mongodb got a perl script that parses a twitter
Hi am just started working on grails.. developed my first application in grails can
I just started working on a new project that already contains a .svn folder
I just started working with Uploadify with our Java/JSP Applications and for that I
I just started working for the first time with a product that's delivered via
I just started working on a project that will run on google app engine

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.