search function using mvccontrinb

search function using mvccontrinb

kmatth007kmatth007 Posts: 1Questions: 0Answers: 0
edited March 2012 in DataTables 1.9
I am trying to implement a searchable grid in a MVC application using MVCContrib and jquery datatable.

When I run the application I get a "SCRIPT5007: Unable to get value of the property 'className': object is null or undefined" error. It appears to have a problem with the .Attributes(id => "example") code and the end of the grid. If I remove this line it loads fine but then i don't have the search box for the grid. Any help would be greatly appreciated. Thanks!

@{
Entities db = new Entities();
IEnumerable User = db.User.ToList();
}

@{


$(document).ready(function () {
$('#example').dataTable({
"iDisplayLength": 25,
"aaSorting": [[3, "asc"]],
"aoColumns": [{ "bSortable": false }, null,
null, null, null, { "bSortable": false}]
});
});



@Html.Grid(User).Columns(column =>
{
column.For(c => c.FirstName);
column.For(c => c.LastName);
column.For(c => c.Email);
//column.For(c => Html.ActionLink("Send e-mail", "Send", new { id = c.UserGUID })).Encode(false);

}).Attributes(id => "example")

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    I'm afraid I don't have a clue about MVCContrib, but is the HTML being created for a TABLE with TBODY and THEAD? Are you getting any control errors? Can you use the debugger to get a debug trace please?

    Allan
This discussion has been closed.