Click here to Skip to main content
15,065,914 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
For a few hours I'll try to do search from the database. I wrote the code to find the data from the database when you click, but it does not work. After clicking nothing has changed, and I wish searched for example, "John" ... Someone help me why this is?

using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Project_MVC;

namespace Project_MVC.Controllers
    public class MyController : Controller
        private mydatabase db = new mydatabase();

        public JsonResult CheckData(string name = "",string cityid = "", int jtStartIndex = 0, int jtPageSize = 0, string jtSorting = null)
                //Get data from database
                using (var ls = new mydatabase())
                    Wdata = ls.Procedure_ShowData(name,cityid).ToList<Procedure_ShowData_Result>();

                //Return result to jTable
                return Json(new { Result = "OK", Records = Wdata });
            catch (Exception ex)
                return Json(new { Result = "ERROR", Message = "No good" });
        Name: <input type="text" name="name" id="name" />
       CityId: <input type="text" name="cityid" id="cityid" />
        <button type="submit" id="LoadRecordsButton">Load records</button>

            messages: polishMessages,
            paging: true, //Enable paging
            pageSize: 10,
            sorting: true,
            actions: {
                listAction: '@Url.Action("Check")'
            fields: {
            Name: {
                    title: 'Name',
                    width: '20px'
                CityId: {
                    title: 'CityId',
                    width: '20px'
 $('#LoadRecordsButton').click(function (e) {
            $('#Check').jtable('load', {
                Name: $('#name').val(),
                CityId: $('#cityId').val()
Updated 10-Aug-13 10:31am

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

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900