Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: ASP.NET MVC3
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 23:42pm
Edited 5-Aug-12 0:44am
Pablo Aliskevicius at 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 at 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
0 Zoltán Zörgő 300
1 Peter Leow 160
2 CPallini 120
3 BillWoodruff 120
4 CHill60 100
0 Sergey Alexandrovich Kryukov 9,423
1 OriginalGriff 6,891
2 Peter Leow 4,692
3 Zoltán Zörgő 4,344
4 CHill60 2,932

Advertise | Privacy | Mobile
Web02 | 2.8.150129.1 | Last Updated 5 Aug 2012
Copyright © CodeProject, 1999-2015
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