Partial view script in _grid.cshtml not working

Apr 26, 2013 at 7:47 PM
Edited Apr 26, 2013 at 7:48 PM
I just started with that grid and stumbled into access violations in my view when the script was executed:
    pageGrids.myGrid.onRowSelect(function (row) {
        $.post("/Home/GetOrder?id=" + row.OrderID, function (data) {
            if (data.Status <= 0) {
Reason was, that the script in partial view _grid.cshtml was never executed - don't know why this happens because the sample works ..... Also, VS2012 indicates a syntax error in _grid.cshtml script!

Some other comments indicate partial views should not contain script at all, so I copied the partial script into the main view script and it worked.
This part should be analyzed in greater detail.
Apr 27, 2013 at 4:27 AM
Hi, can you provide more infomation about error?

You need to ensure that your page contains references to jquery.js and gridmvc.js in the <head> section
Apr 27, 2013 at 11:09 AM
OK, I haved move jquery.js and gridmvc.js in the <head> section - seems to work now.
You should consider standard behavior of script following html. By now, all pages in MVC4 will receive the reference to gridmvc.js

The Error: Image
I did not go further into both errormessages (VS2012 only calls it syntax error)
Apr 27, 2013 at 11:22 AM
Yes. now you need to reference gridmvc.js on each page, which renders the grid, because this script adds some client functionallity, like filtering popups. I will fix it in the next release.

Btw, it seems that you use the last repository version, which is not released. I recommend you to use the last 2.3.0 release: