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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:27:49+00:00 2026-05-22T18:27:49+00:00

I have a jqGrid on a page wrapped inside an ASP.NET web part. Here

  • 0

I have a jqGrid on a page wrapped inside an ASP.NET web part. Here is it’s definition:

$("#referent_grid").jqGrid({
    url: '<%= SPContext.Current.Site.Url %>' + wsBaseUrl + 'ReferentService.asmx/ListReferents',
    colNames: ['Full Name', 'Phone Number', 'Email', 'Department'],
    colModel: [
        { name: 'FullName', index: 'FullName', width: 240, align: 'left', search: true, stype: 'text', searchoptions: { sopt: ['eq', 'bw', 'bn', 'ew', 'en', 'cn', 'nc']} },
        { name: 'PhoneNumber', index: 'PhoneNumber', width: 120, align: 'left', search: true, stype: 'text', searchoptions: { sopt: ['eq', 'bw', 'bn', 'ew', 'en', 'cn', 'nc']} },
        { name: 'Email', index: 'Email', width: 180, align: 'left', search: true, stype: 'text', searchoptions: { sopt: ['eq', 'bw', 'bn', 'ew', 'en', 'cn', 'nc']} },
        { name: 'Department', index: 'Department', width: 180, align: 'left', search: true, stype: 'text', searchoptions: { sopt: ['eq', 'bw', 'bn', 'ew', 'en', 'cn', 'nc']} },
    ],
    jsonReader: {
        id: "ReferentID"
    },
    pager: $('#referent_grid_pager'),
    sortname: 'FullName',
    sortorder: "asc",
    height: '300',
    shrinkToFit: false,
    caption: 'Referent List'
});
$("#referent_grid").jqGrid('navGrid', '#referent_grid_pager',
    { add: true, addtitle: 'Add Referent', edit: true, edittitle: 'Edit Referent',
      del: true, deltitle: 'Delete Referent', refresh: true, refreshtitle: 'Refresh data',
      search: true, searchtitle: 'Advanced search filters',
      addfunc: addReferent, editfunc: editReferent
    },
    {}, // default settings for edit
    {}, // default settings for add
    { // define settings for Delete 
        mtype: "post", reloadAfterSubmit: true,
        url: '<%= SPContext.Current.Site.Url %>' + wsBaseUrl + 'ReferentService.asmx/DeleteReferent',
        resize: false,
        serializeDelData: function (postdata) {
            return JSON.stringify({ referentID: postdata.id });
        },
        afterSubmit: function (data, postdata) {
            var result = $.parseJSON(data.responseText);
            return [true, ''];
        }
    },
    { closeOnEscape: true, multipleSearch: true, closeAfterSearch: true }, // search options
    {}
);

As you can see I have Advanced Search enabled. The problem I am facing to is that the first time the page is called the jqGrid calls the ListReferents method without passing the filters parameter as you can see in the following screenshot from Fiddler

First call

When I click on the refresh button of the jqGrid it calls the ListReferents method passing the filters parameter as you can see in the following screenshot from Fiddler

Call from refresh

To arrange this I have defined two methods inside my web service but the first method does never get called while the second is.

[WebMethod]
public JQGridData ListReferents(string _search, string nd, string rows, string page, string sidx, string sord) {
    return ListReferents(_search, nd, rows, page, sidx, sord, string.Empty);
}

[WebMethod]
public JQGridData ListReferents(string _search, string nd, string rows, string page, string sidx, string sord, string filters) {
    // method code here
}

Where am I 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-22T18:27:49+00:00Added an answer on May 22, 2026 at 6:27 pm

    The problem is that all parameters of the web service should be defined. Only 5 standard parameters :_search, rows, page, sidx, sord are always defined in the request to the server. So you have to test inside of serializeGridData whether the filter property is defined in the postData. If not defined you should set it to null or to the empty string "":

    serializeGridData: function (postData) {
        if (postData.filters === undefined) postData.filters = null;
        return JSON.stringify(postData);
    }
    

    (See here an example). It should solve your problem.

    Additionally you should remove traling commas in the colModel definition (camma before ‘]’).

    One more small suggestion. You can simplify the column definition in the colModel. First of all you can remove align: 'left', search: true, stype: 'text' properties which are default (see the documentation). Moreover is you have some common settings in the most of columns you can redefines the default values for colModel of the grid with respect cmTemplate parameters:

    colModel: [
        { name: 'FullName', index: 'FullName', width: 240 },
        { name: 'PhoneNumber', index: 'PhoneNumber', width: 120 },
        { name: 'Email', index: 'Email', width: 180 },
        { name: 'Department', index: 'Department', width: 180 }
    ],
    cmTemplate: { searchoptions: { sopt: ['eq', 'bw', 'bn', 'ew', 'en', 'cn', 'nc']} }
    

    see more about the column templates here.

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

Sidebar

Related Questions

i have an asp.net-mvc web page and i am using jqgrid on the front
I have a asp.net webforms page in which I'm using the jqGrid component. The
I have a project in ASP.NET MVC1 using VB.NET controlers and JqGrid. it works
I have a jqGrid in an ASP.Net MVC. The grid is defined as: $(#list).jqGrid({
I have a jqGrid on an ASP.Net MVC view. I want to use to
I am needing to have a dynamic jqgrid on my asp.net mvc3 app. The
i have the following code on my aspx page: jQuery(#listFondos).jqGrid({ url: '/PorMyController/LoadGridData/', datatype: 'json',
In my ASP.NET MVC 3 app I have the pager enabled on my jqGrid,
I have a jqGrid on a web page, with large data sets. Up to
I have a jqGrid on an ASP.Net MVC view. I want to use to

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.