Datatables.net and integration with ASP.Net

Datatables.net and integration with ASP.Net

tarnetttarnett Posts: 8Questions: 4Answers: 0

Hi folks,
Has anyone ever used datatables in an ASP.NET (c#) environment? I'm using Visual Studio 2015 with a SQL Server 2012 backend.

What methods are used to load the datatable.net grid?

Thanks guys!

Answers

  • allanallan Posts: 63,761Questions: 1Answers: 10,510 Site admin

    WebAPI is the method I tend to prefer myself for Ajax loaded data, but you could easily just generate a standard HTML table and use DataTables on that.

    Allan

  • tarnetttarnett Posts: 8Questions: 4Answers: 0

    Allan, thanks for the reply.

    I have an ASP.Net page with a MicroSoft gridview control. Is there anyway I can use datatables in place of the gridview? How would I load the datatable data?

    Any examples floating around on the forum?

    Thanks!

  • allanallan Posts: 63,761Questions: 1Answers: 10,510 Site admin

    Probably but I don't use GridView myself so I don't know what its output is. You could do a search to see if anyone else has written about this.

    Allan

  • tarnetttarnett Posts: 8Questions: 4Answers: 0

    I'm sorry - I guess I'm not asking the right question.
    If I use DataTables for my table display in my ASP.Net page, what would be my data source? I'm using ADO.Net to retrieve data from a SQL Server database.

    How would I associate the datatable with my result set from my query?

  • allanallan Posts: 63,761Questions: 1Answers: 10,510 Site admin

    Two options:

    1. Build the HTML table and let DataTables read it from the DOM
    2. Create JSON with the data and let DataTables read that.

    See the data manual pages.

    Allan

This discussion has been closed.