Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have added all necesary Jquery & JqGrid scripts and css.
I am using MVC5.
i got "Uncaught TypeError: Cannot read property 'msie' of undefined" error.
So I have added jquery-migrate-1.2.1 script. after Jquery.

--warning msg JQMIGRATE: jQuery.browser is deprecated.

What I have tried:

JavaScript
$(document).ready(function () {

        debugger;
        $('.Importtbl').jqGrid({
            datatype: 'Json',
            mtype: 'GET',
            url: '@Url.Action("ImportData", "ReportablePayments")',
            colNames: ['PaymentDate', 'PayeeName', 'SrcDocType', 'Amount', 'Check Number', 'Object Code'],
            colModel: [
                { name: 'PaymentDate', index: 'PaymentDate', width: 20 },
                 { name: 'PayeeName', index: 'PayeeName', width: 50 },
                  { name: 'SrcDocType', index: 'SrcDocType', width: 20 },
                   { name: 'Amount', index: 'Amount', width: 15 },
                    { name: 'CheckNumber', index: 'CheckNumber', width: 20 },
                     { name: 'ObjectCode', index: 'ObjectCode', width: 10 }

            ],
            pager: '#pager',
            caption: 'Import Raw DATA',
            viewrecords: true,
            rowNum:10
        })

    });




----Controller.cs
public ActionResult ImportData(int rows,string sidx,string sord,int page)
{
return Json(null,JsonRequestBehavior.AllowGet);
}
Posted
Updated 12-Oct-17 8:07am
v3
Comments
Bryian Tan 12-Oct-17 14:15pm    
I don't see where in the posted code is referencing the plugin. Why the application need that plugin anyway?

By the way, why ImportData method is returning null to the jQGrid instead of JSON object?
Member 13461662 13-Oct-17 11:39am    
This is my layout page
<!DOCTYPE html>


<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title - My ASP.NET Application
@Styles.Render("~/Content/css")












@Scripts.Render("~/bundles/modernizr")




@Html.ActionLink("Application name", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })



@Html.ActionLink("Home", "Index", "Home")
@Html.ActionLink("About", "About", "Home")
@Html.ActionLink("Contact", "Contact", "Home")

@Html.Partial("_LoginPartial")
@RenderBody()

© @DateTime.Now.Year - My ASP.NET Application
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("scripts", required: false)



I am using this layout page in my view.

I am just trying to see empty table.instead of data. JqGrid is not calling ImportData method.

-----Controller.cs
public ActionResult Index()
{
return View();
}
[HttpGet]
public ActionResult ImportData(int rows,string sidx,string sord,int page)
{
return Json(null,JsonRequestBehavior.AllowGet);
}
Member 13461662 13-Oct-17 11:46am    
I don't know some how my scripts are not posting here.
But i am using below scripts in layout page after
Styles.Render("~/Content/css")
jquery-ui-1.12.1.custom/jquery-ui-1.12.1.custom/jquery-ui.css
jquery.jqGrid-3.8.2/css/ui.jqgrid.css
jquery-3.2.1.min.js
jquery-migrate-1.4.1.js
jquery.mb.browser.js
jquery.jqGrid-3.8.2/js/i18n/grid.locale-en.js
jquery.jqGrid-3.8.2/js/jquery.jqGrid.min.js

Thank you so much for your response.
Member 13461662 13-Oct-17 11:56am    
This is my BundleConfig.cs

public static void RegisterBundles(BundleCollection bundles)
{
//bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
// "~/Scripts/jquery-{version}.js"));

//bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
// "~/Scripts/jquery.validate*"));

//// Use the development version of Modernizr to develop with and learn from. Then, when you're
//// ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
"~/Scripts/modernizr-*"));

bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
"~/Scripts/bootstrap.js",
"~/Scripts/respond.js"));

bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/bootstrap.css",
"~/Content/site.css"));
}

I have commented Jquery scripts.because i am using scripts from layout.But I am using bootstrap and css from bundle which is rendered in layout page
Bryian Tan 13-Oct-17 11:56am    
can you remove the plugin jQuery.browser and all references?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900