Grid error

Mar 4, 2012 at 2:23 AM
Edited Mar 4, 2012 at 2:24 AM

I try to use Grid Control on MVC 3 and Razor engine - error don't raise, but grid is not rendering. Here my code:

@using MVC.Controls.Grid

@Html.Grid(new GridControl().SetName("grid")
        .SetPageSize(10)
        .SetIsAutoSize(true)
        .SetHttpVerb(HttpVerbs.Get)
                .SetDataSource(Model)
            .SetColumns<ZxSpectrumPortal.Models.GameModel>(cs =>
{
    cs.Add(x => x.GameName);
    cs.Add(x => x.GameYear).SetAsPrimaryKey();
    cs.Add(x => x.GameGenre);
    cs.Add(x => x.GameFile);
            }))

 

Rendering part of control:

<table id="grid"></table>
<div id="gridPager"></div>
<script language="javascript" type="text/javascript">grid_dataSource = [{"GameName":"weqe","GameYear":213123,"GameGenre":"asdasd","GameFile":"asdads"},{"GameName":"qwqwe","GameYear":21312,"GameGenre":"asAS","GameFile":"asdasd"},{"GameName":"gfdgdf","GameYear":32423,"GameGenre":"fsdfsd","GameFile":"werwerwer"},{"GameName":"newgame","GameYear":1111,"GameGenre":"1111","GameFile":"1111"}];</script><script language="javascript">$(document).ready(function() {
$("#grid").jqGrid({
url: "",
data: grid_dataSource,
datatype: "local",
colNames: ["GameName","GameYear","GameGenre","GameFile"],
colModel: [{ name: "GameName", index: "GameName", width: 50, align: "center", sortable: true, editable: true, hidden: false, edittype: 'text'}, 
{ name: "GameYear", index: "GameYear", width: 50, align: "center", sortable: true, key: true, editable: true, hidden: false, edittype: 'text'}, 
{ name: "GameGenre", index: "GameGenre", width: 50, align: "center", sortable: true, editable: true, hidden: false, edittype: 'text'}, 
{ name: "GameFile", index: "GameFile", width: 50, align: "center", sortable: true, editable: true, hidden: false, edittype: 'text'}],
rowNum: 10,
prmNames: {id: "GameYear"},
ngridComplete: function f(){updateButtonState($('#grid'));},
rowList: -1,
pager: $("#gridPager"),sortname: "GameName",
autowidth: true,
onSelectRow: function(id){updateButtonState($('#grid'));
if ($("#Id").length == 0) {return;}$("#Id")[0].value = $("#grid").getRowData(id).GameYear;},caption: ""});
$('#grid').navGrid('#gridPager',{add: false, edit:false, del: false, search: true, view: false, refresh: true},{afterSubmit:handleMvcResponse}, {afterSubmit:handleMvcResponse}, {afterSubmit:handleMvcResponse}, {multipleSearch:true});
});
</script>

Can anyone help??