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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:24:54+00:00 2026-06-17T09:24:54+00:00

I have the following: function setupGrid(labId) { var url = ‘@Url.Action(GetProgData, Prog)’ + ‘?lId=’

  • 0

I have the following:

     function setupGrid(labId) {

       var url = '@Url.Action("GetProgData", "Prog")' + '?lId=' + lId;
       alert(url);

       $("#loginList").jqGrid({
         url: url,
         datatype: "json",
         colNames: ['PNum', 'Client', 'Salesperson', 'Email', ....
       .....
       .....  

I also have the following code:

    <script type="text/javascript">
      $(document).ready(function () {
       var labId;

       $("#LabId").change(function () {   // point1
        labId = $("#LabId").val();
        setupGrid(labId); // this goes to setupGrid but DOES NOT go to the given url( url = '@Url.Action("GetProgData", "Prog")' + '?lId=' + lId;)         
       });

       // point 2
       setupGrid(labId);  // this goes to setupGrid  and DOES go to the given url(url = '@Url.Action("GetProgData", "Prog")' + '?lId=' + lId;)
       ......

When the program runs the first time, it goes to point2 which then goes to setupGrid function and goes to the url value in:

    url: url

When I call it from the .change (point1) it again goes to SetupGrid and the alert shows the correct value but cannot understand why when I put a breakpoint at the url it does not go to the url. Why does it work the first time but when I do it from the .change it does not to go to the url.

  • 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-06-17T09:24:55+00:00Added an answer on June 17, 2026 at 9:24 am

    I see that there are common understanding problem how jqGrid works.

    If you use $("#loginList").jqGrid({...}); you need have empty <table> element with id="loginList". jqGrid convert the <table> element to relatively complex structure of divs, tables etc. So jqGrid initialize the grid first of all. It build outer part of the grid.

    Then jqGrid make Ajax call to url (in case of usage datatype: "json" or datatype: "xml") and fill the grid body. One can use $("#loginList").trigger("reloadGrid") to refresh the grid body.

    I hope that it should be clear now that one can call $("#loginList").jqGrid({...}); only once. It you do try to create the grid one more time from existing grid l will be just ignored.

    What you should do is just rewriting the code to the following

    $(document).ready(function () {
        var labId;
    
        $("#loginList").jqGrid({
            url: '@Url.Action("GetProgData", "Prog")',
            postData: {
                lId: function () {
                    return $("#LabId").val();
                }
            },
            datatype: "json",
            colNames: ['PNum', 'Client', 'Salesperson', 'Email', ....
        });
    
        $("#LabId").change(function () {   // point1
            $("#loginList").trigger("reloadGrid");
        });
    });
    

    You can read here more about the usage of methods inside of properties of postData. In another answer you will find alternative way which could be practical in case if it’s require to send values from all controls of one form to the controller action.

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

Sidebar

Related Questions

I have the following example: var url = '@Url.Action(GetProgData, Prog)' + '?lbId=' + labId;
I have following scripts: function PostChartValues(meter_id, range_type_id, start_date, end_date) { $.ajax({ url: '@Url.Action(GetMeterReadingsTimeSeries, Widget)',
I have following function to return the selectlist of the action name from controller
I have following function in jquery: $('canvas').createWindow('xyz', 500, 600); And js-code behind is: var
I have following function : function a() { var d = { foo :
I have the following function: function red(opt) { var sqr; sqr=r+parseInt(opt); hilight_css = {background-color:#f00};
I have the following function: $(function() { var address = $(#address).text(); var r; function
I have following PHP function which gets current URL: function getCurrentUrl() { $isHTTPS =
I have following function in one Activity public void AppExit() { Editor edit =
In my MVC application in Controller i have following function to add and focus

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.