DataTables logo DataTables

via Ad Packs
search function using mvccontrinb
  • 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<XXXX.DAL.User> User = db.User.ToList();
    }

    @{

    <script type="text/javascript" charset="utf-8">
    $(document).ready(function () {
    $('#example').dataTable({
    "iDisplayLength": 25,
    "aaSorting": [[3, "asc"]],
    "aoColumns": [{ "bSortable": false }, null,
    null, null, null, { "bSortable": false}]
    });
    });
    </script>

    <div id="container">
    @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")

    </div>
  • allanallan
    Posts: 15,505
    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.
← All Discussions

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Support

Get useful and friendly help straight from the source.

In this Discussion