Click here to Skip to main content
13,456,800 members
Rate this:
Please Sign up or sign in to vote.
See more:
I'm new to ASP.NET though I have a rigid understanding, I've just read this article AJAX based CRUD tables using ASP.NET MVC 3 and jTable jQuery plug-in[^]
and if I could implement it, I'll finish my project in hours...


here is my code and all I get is a blank page, and the UserList() function isn't called at all.

Public Class DemoController
        Inherits System.Web.Mvc.Controller

        Private db As New LernJTableEntities

        ' GET: /Demo

        Function Index() As ActionResult
            Return View()
        End Function

        Function UserList(Optional jtStartIndex As Integer = 0, Optional jtPageSize As Integer = 0, Optional jtSorting As String = Nothing) As JsonResult
                'Get data from database
                Dim UserCount = db.User.Count
                 Dim Users As New List(Of User)(db.User.Skip(jtStartIndex).Take(jtPageSize))

                'Return result to jTable
                Return Json(New With {.Result = "OK",
                                      .Records = Users,
                                      .TotalRecordCount = UserCount})
            Catch ex As Exception
                Return Json(New With {.Result = "ERROR",
                                      .Message = ex.Message})
            End Try
        End Function

        Function DeleteUser() As JsonResult

        End Function

        Function UpdateUser() As JsonResult

        End Function

        Function CreateUser() As JsonResult

        End Function

    End Class

    ViewData("Title") = "Users"
End Code

<div id="UserTableContainer">

<script type="text/javascript">

    $(document).ready(function () {

            title: 'User List',
            paging: true,
            pageSize: 10,            
            actions: {
                listAction: '@Url.Action("UserList")',
                deleteAction: '@Url.Action("DeleteUser")',
                updateAction: '@Url.Action("UpdateUser")',
                createAction: '@Url.Action("CreateUser")'
            fields: {
                UserId: {
                    key: true,
                    create: false,
                    edit: false,
                    list: false
                Name: {
                    title: 'Name',
                    width: '100%'

        //Load user list from server


and I didn't forgot to put those two in the HEAD section in _Layout.vbhtml
<link href="@Url.Content("~/jtable/themes/standard/blue/jtable_blue.css")" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="@Url.Content("~/jtable/jquery.jtable.js")"></script>

as it is only my first steps my table [user] consist only two fields {UserId,Name}

What am I missing here?
thank you in advance..
Posted 4-Aug-12 22:42pm
Updated 4-Aug-12 23:44pm
Pablo Aliskevicius 5-Aug-12 8:58am
Do you have a reference to
<script src="/Scripts/jquery-1.6.4.min.js" type="text/javascript"></script>
Igal_Berezovsky 5-Aug-12 9:06am
I also needed this one:
<script src="@Url.Content("~/Scripts/jquery-ui-1.8.16.custom.min.js")" type="text/javascript"></script>

Thank you I was clueless

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Although it seems you got your answer, I want to add, I don't think this is a great way of doing things. It looks like this library is doing some magic hookup stuff for you. MVC will create a CRUD controller for you for free, but overall, you should be writing code that uses a viewmodel, because this will give you a lot more control over what is happening, compared to this, assuming this works.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.180322.1 | Last Updated 5 Aug 2012
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100