Rohan Büchner
Rohan Büchner

Reputation: 5393

Asp.Net4 Javascript/jquery Minification Error

I realize this might be stupid, and its probably caused by my lack of javascript/jquery knowledge (in terms of re-factoring etc..)

I'm rendering a JQGrid component on my page like this.

<script src="@System.Web.Optimization.BundleTable.Bundles.ResolveBundleUrl("~/JQGrid")" type="text/javascript"></script>
<script type="text/javascript">

    var colNames = ['S ID', 'Shift Description'];
    var colModel = [
            { name: 'S_ID', index: 'S_ID', key: true, width: 55, editable: false, hidden: true, search: false },
            { name: 'Shift_Description', index: 'Shift_Description', width: 100, align: "right", editable: true, editrules: { required: true }, formoptions: { rowpos: 1, colpos: 1}}];

    RenderJQGrid("#theGrid", '#pager', '@ViewBag.Title', 600, colNames, colModel, 'S_ID', null, null, null, '@Url.Action("GridData")', '@Url.Action("Add")', '@Url.Action("Edit")', '@Url.Action("Delete")', '@Url.Action("ExportToExcel")');

</script>

Inside my .js file, I only have this. (it's also the only file in the bundle)

function RenderJQGrid(GridID, PagerID, Title, ModalWidth, ColNames, ColModel, InitSortCol, OnLoadComplete, EditBeforeShowOptions, AddBeforeShowOptions, URL_get, URL_add, URL_edit, URL_delete, URL_excel) {

   ... Logic
}

I'm receiving this error in fiddler though.

/* Minification failed. Returning unminified contents.

(1,10): run-time error CSS1031: Expected selector, found 'RenderJQGrid('

(1,10): run-time error CSS1025: Expected comma or open brace, found 'RenderJQGrid('

*/

what am i doing wrong/missing? the code seemed fine when it was embedded inside my html page?

Upvotes: 1

Views: 2298

Answers (1)

Leon
Leon

Reputation: 552

I ran into a similar problem. My issue was that I was using a StyleBundle to bundle *.js files

Upvotes: 7

Related Questions