Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9164337
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:39:31+00:00 2026-06-17T14:39:31+00:00

I am using Datatables in my application, but to fetch the data controller method

  • 0

I am using Datatables in my application, but to fetch the data controller method is not getting triggered.
I am able to render the table on UI, but the data is coming is NULL.

Here is my code

Imported items in SITE.MASTER

 <link href="/Scripts/DataTables/media/css/demo_page.css" type="text/css"  rel="stylesheet" />

     <link href="/Scripts/DataTables/media/css/demo_table.css" type="text/css"  rel="stylesheet" />


      <script src="/Scripts/Lib/jquery-1.4.2.js" type="text/javascript" language="javascript"></script>

     <script type="text/javascript" charset="utf-8" src="/Scripts/DataTables/media/js/jquery.dataTables.js"></script>

Here is my HTML Looks

!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>http://stackoverflow.com/questions/6946559/jqgrid-please-help</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
       <script type="text/javascript" charset="utf-8">
            $(document).ready(function () {
                $('#example').dataTable({
                    bProcessing: true,
                    sAjaxSource: '@Url.Action("GridData", "Home")'
                });
            });
        </script>

 </head>
<div id="dynamic">
<table cellpadding="0" cellspacing="0" border="0" class="display" id="example">
    <thead>
        <tr>
            <th width="20%">Rendering engine</th>
            <th width="25%">Browser</th>
            <th width="25%">Platform(s)</th>
            <th width="15%">Engine version</th>
            <th width="15%">CSS grade</th>
        </tr>
    </thead>
    <tbody>

    </tbody>

</table>
</div>
</html>

Here how my JS file which loads HTML looks

var rptTabs = function () {
    return {
        Init: function () {



            var placeholder = $("#rpt-tab");
            placeholder.setTemplateURL("/Templates/Home/report.htm");


            placeholder.load("/Templates/Home/report.htm");



        }
    }
} ();

Here how my Home controller method looks

public ActionResult GridData()
        {
            return Json(new
            {
                aaData = new[] 
            {
                new [] { "Trident", "Internet Explorer 4.0", "Win 95+", "4", "X" },
                new [] { "Gecko", "Firefox 1.5", "Win 98+ / OSX.2+", "1.8", "A" },
                new [] { "Webkit", "iPod Touch / iPhone", "iPod", "420.1", "A" }
            }
            }, JsonRequestBehavior.AllowGet);
        }

Please tell me what is wrong with my implementation.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T14:39:32+00:00Added an answer on June 17, 2026 at 2:39 pm

    The problem is related to the fact that you are using a server side helper (Url.Action("GridData", "Home")) inside a static HTML template since you have incorrectly copy-pasted my solution from here without adapting it to your scenario. Furthermore you are using the WebForms view engine and not Razor.

    So I would recommend you making this template an ASPX WebForm, served through a controller action which would allow you to use server side helpers inside.

    public class TemplatesController: Controller
    {
        public ActionResult Report()
        {
            return View();
        }
    }
    

    And then you will have a corresponding view:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>https://stackoverflow.com/questions/6946559/jqgrid-please-help</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <script type="text/javascript" charset="utf-8">
        $(document).ready(function () {
            $('#example').dataTable({
                bProcessing: true,
                sAjaxSource: '<%= Url.Action("GridData", "Home") %>'
            });
        });
        </script>
    </head>
    <div id="dynamic">
    <table cellpadding="0" cellspacing="0" border="0" class="display" id="example">
        <thead>
            <tr>
                <th width="20%">Rendering engine</th>
                <th width="25%">Browser</th>
                <th width="25%">Platform(s)</th>
                <th width="15%">Engine version</th>
                <th width="15%">CSS grade</th>
            </tr>
        </thead>
        <tbody>
    
        </tbody>
    </table>
    </div>
    </html>
    

    and then specify the correct path to this controller when loading the template (once again by using server side helper).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using jQuery DataTables in my .NET web application but how do I set
I am using Datatables grid in my MVC application to show the data. I'm
I am getting DataTables warning: JSON data from server could not be parsed. This
I'm using prime faces data table in my application where i have a checkbox
I am using datatables for my application, multiselect is working in first page but
I'm using http://datatables.net/examples/ for easy control table. I'm generating table with more than 30,000
I'm building a simple search table (eventually using jquery Datatables) for our knowledgebase. I'm
I am using datatables in my application. Whenever user click on any row I
I am using Datatables grid in one of my application because it has a
I am using jquery datatables serverside in my MVC application. When I put a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.