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 7669887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T15:41:49+00:00 2026-05-31T15:41:49+00:00

I am new to .net. I want to create a DataTable example. My table

  • 0

I am new to .net. I want to create a DataTable example. My table is in “sql” management studio. I want to load that table into my DataTable. How can i do this? I can get the table using connection string but how to fix it in DataTable?

Please show me the code if you have it. Don’t forget that i am a beginner only. Please explain clearly.

I’ve got some code like this:

<script type="text/javascript" >
    $(document).ready(function() {
        $('#example').dataTable({
            "bProcessing": true,
            "bServerSide": true,
            "sAjaxSource": "somefile"
        });
    });
</script>

Please explain it to me.

Thanks in advance.

  • 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-05-31T15:41:50+00:00Added an answer on May 31, 2026 at 3:41 pm

    To give you some encouragement, I was very new to .NET and javascript about nine months ago (and arguably still am) but I was still able to use the resources on datatables.net to make a very nice, functional datatable using ASP.net and a SQL server. A couple of suggestions:

    First: The examples page, API reference, and forums on datatables.net are going to be your best resources. I’ve spent days coding some really complicated way to get the table to do something relatively simple only to find through the reference page that there was already an easy, sophisticated native way to do that.

    Second: If you’re using MVC and it’s really necessary to do server side processing (if not see below), there is a great tutorial on code project about how to do set this up with datatables.net.

    Third: Server side processing gives you a lot of control over the way the table renders your data, but it requires you to code sorting and pagination functions by hand. The alternative method, that I use, is the sAjaxSource initialization option for the table without bServerSide set to true — as this allows me dynamically load the data from an external (AJAX) source, while still letting the datatable plugin do all of the heavy lifting. Here’s the setup I have (I apologize if this is too simplistic):

    1. I have an empty table in my HTML, with just the headers of each column specified. Make sure you have the thead and tbody tags.

    2. In your .NET project, create a new “Generic Handler” (the extension should be .ashx). This handler will handle a request from your main page for your data (you’ll see below). Here, I do the following:

      a. I connect to my SQL database

      b. Retrieve the view of the table I’m looking for

      c. Parse each row into an object (I created a new class for this)

      d. Serialize an array of my “row objects” into a JSON object (as this will be the easiest way for the datatable to work with your data

      e. Write the response back to the page

      I’d be happy to share my code that I use to do this, but I can already feel this post becoming too long, so just let me know if you want it.

    3. I then setup my datatable in the page’s javascipt, within the $(document).ready function. I use the .ashx file as my AJAX source and then I specify the name that I use as the key for each column in my JSON object – using the mDataProp option:

      oTable = $("#production_table").dataTable({            
          "sAjaxSource": 'Data.ashx', 
              // ^ Change this ashx filename based on 
              //   the file you created above in #2  
          "aoColumns": [
              { "mDataProp": "column1" },
              { "mDataProp": "column2" },
              { "mDataProp": "column3" } ]
      });
      

    Good luck!

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

Sidebar

Related Questions

I want to create a new net.tcp://localhost:x/Service endpoint for a WCF service call, with
I am new In ASP.NET, I want to create to Login Form using Membership
I am new to .NET, and I want to create a simple application in
When I create a new ASP.NET project in Visual Studio 2010, it creates the
I installed the new Visual Studio 2010. I want to create a C# Winform
I want to create a custom asp.net mvc3 helper . To use that helper,
I'm new to ASP.NET and C# and I want to create simple webapp. How
I am new for ASP.Net application. Now I want to create a website. How
Say I want to create vb.net application in Visual studio 2005. What is the
i want to create an anonymous class in vb.net exactly like this: var data

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.