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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:21:07+00:00 2026-06-04T17:21:07+00:00

in asp-mvc, i have a partial view which contains this: <table id=grid> </table> <div

  • 0

in asp-mvc, i have a partial view which contains this:

<table id="grid">
</table>
<div id="pager1">
</div>

<script language="javascript" type="text/javascript">
$('#grid').jqGrid({
    url: '/Employee/JsonEmployee',
    datatype: 'json',
    mtype: 'GET',
    colNames: ['NUMBER', 'NAME', 'ROLE', 'OPERATIONS'],
    colModel: [
{ name: 'NUMBER', index: 'number', width: 200, sortable: false, align: 'center' },
{ name: 'NAME', index: 'name', width: 300, sortable: false, align: 'center' },
{ name: 'ROLE', index: 'role', width: 200, sortable: false, search: false, align: 'center' },
{ name: 'OPERATIONS', index: 'operation', width: 200, sortable: false, search: false, align: 'center'}],
    rowNum: 10,
    rowList: [10, 20, 30],
    pager: '#pager1',
    sortname: 'number',
    viewrecords: true,
    sortorder: "desc",
    height: "100%",
    caption: "EMPLOYEES"
});
jQuery("#grid").jqGrid('navGrid', '#pager1', { del: false, add: false, edit: false }, {}, {}, {}, { width: 600 });

</script>

it is working fine but then, i decided to remove the script at the bottom of my view and put it in a javascript(.js) file in the Scripts folder: Local.js

function () {
$('#grid').jqGrid({
    url: '/Employee/JsonEmployee',
    datatype: 'json',
    mtype: 'GET',
    colNames: ['NUMBER', 'NAME', 'ROLE', 'OPERATIONS'],
    colModel: [
{ name: 'NUMBER', index: 'number', width: 200, sortable: false, align: 'center' },
{ name: 'NAME', index: 'name', width: 300, sortable: false, align: 'center' },
{ name: 'ROLE', index: 'role', width: 200, sortable: false, search: false, align: 'center' },
{ name: 'OPERATIONS', index: 'operation', width: 200, sortable: false, search: false, align: 'center'}],
    rowNum: 10,
    rowList: [10, 20, 30],
    pager: '#pager1',
    sortname: 'number',
    viewrecords: true,
    sortorder: "desc",
    height: "100%",
    caption: "EMPLOYEES"
});
jQuery("#grid").jqGrid('navGrid', '#pager1', { del: false, add: false, edit: false }, {}, {}, {}, { width: 600 });

  };

i called the script file in my _Layout.cshtml:

 <head>
    <meta charset="utf-8" />
    <link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
    <link href="@System.Web.Optimization.BundleTable.Bundles.ResolveBundleUrl("~/Content/css")" rel="stylesheet" type="text/css" />
    <link href="@System.Web.Optimization.BundleTable.Bundles.ResolveBundleUrl("~/Content/themes/base/css")" rel="stylesheet" type="text/css" />
    <script src="@System.Web.Optimization.BundleTable.Bundles.ResolveBundleUrl("~/Scripts/js")"></script>

    <script src="@Url.Content("~/Scripts/i18n/grid.locale-en.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.jqGrid.min.js")" type="text/javascript"></script>
   <script src="@Url.Content("~/Scripts/Local.js")" type="text/javascript"></script>
    <meta name="viewport" content="width=device-width" />
</head>

when i run my web app, it’s not working good anymore… the jqGrid is not displayed anymore… where could be the problem?

  • 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-04T17:21:08+00:00Added an answer on June 4, 2026 at 5:21 pm

    Your code in Local.js is never executed, you can call it when the dom is ready with $(document).ready()

    $(document).ready(function () {
        $('#grid').jqGrid({
            url: '/Employee/JsonEmployee',
            datatype: 'json',
            mtype: 'GET',
            colNames: ['NUMBER', 'NAME', 'ROLE', 'OPERATIONS'],
            colModel: [
        { name: 'NUMBER', index: 'number', width: 200, sortable: false, align: 'center' },
        { name: 'NAME', index: 'name', width: 300, sortable: false, align: 'center' },
        { name: 'ROLE', index: 'role', width: 200, sortable: false, search: false, align: 'center' },
        { name: 'OPERATIONS', index: 'operation', width: 200, sortable: false, search: false, align: 'center'}],
            rowNum: 10,
            rowList: [10, 20, 30],
            pager: '#pager1',
            sortname: 'number',
            viewrecords: true,
            sortorder: "desc",
            height: "100%",
            caption: "EMPLOYEES"
        });
        jQuery("#grid").jqGrid('navGrid', '#pager1', { del: false, add: false, edit: false }, {}, {}, {}, { width: 600 });
    });
    
    • 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 Partial View that contains a Html.TextBox that is configured
I have a page which contains a html.RenderPartial, that renders an ASP.NET MVC partial
I am using ASP.Net MVC. I have a partial view which has a form
'm using ASP.NET MVC 3 with Razor views. I have a partial view which
I.e I have a partial view in MVC Asp.net project with loads of javascript
I have a ASP.NET MVC application which has a view populated with a model
I have an Asp.net MVC partial view that is used for searching. It does
I have an ASP.NET MVC website which has a particular javascript file that needs
Inside of an asp.net mvc partial view, I have an Ajax form that posts
I have a number of pages that include the same partial view which contains

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.