want to display data in datatable , How can i do
Sl.NO
ARN
Name of the Applicant
Applicant Address
Site Address
Action

Ahmed AbdiRank #1,099 · 1.7K reputationPosted Jan 24, 2024, 11:13 AM EST
for more here https://datatables.net/
Jayraj ChhayaRank #304 · 8.2K reputationPosted Jan 24, 2024, 10:37 PM EST
To display data in a DataTable in a Dot Net MVC application, you can follow these steps:
Install the required packages: First, make sure you have the necessary packages installed. You can use the NuGet package manager to install the required packages. The most commonly used package for DataTables in Dot Net MVC is "DataTables.AspNet.Mvc5".
Create a model: Create a model class that represents the data you want to display in the DataTable. Define the properties of the model class based on the columns you want to display in the DataTable.
Retrieve data from the database: Use the appropriate data access method (e.g., Entity Framework, ADO.NET) to retrieve the data from the database and populate a list of model objects.
Pass the data to the view: In your controller action method, pass the list of model objects to the view using the ViewBag or a strongly-typed view model.
Configure the DataTable: In the view, use the DataTables JavaScript library to configure the DataTable. You can specify the columns, sorting, filtering, and other options.
Bind the data to the DataTable: Use the DataTables JavaScript library to bind the data to the DataTable. You can use the "data" option to specify the data source and the "columns" option to map the columns to the model properties.
Here's an example of how you can display data in a DataTable in Dot Net MVC:
// Model class public class Applicant { public int SlNo { get; set; } public string ARN { get; set; } public string Name { get; set; } public string ApplicantAddress { get; set; } public string SiteAddress { get; set; } } // Controller action method public ActionResult Index() { List applicants = GetApplicantsFromDatabase(); return View(applicants); } // View @model List Sl.No ARN Name of the Applicant Applicant Address Site Address Action @foreach (var applicant in Model) { @applicant.SlNo @applicant.ARN @applicant.Name @applicant.ApplicantAddress @applicant.SiteAddress Edit } @section scripts { $(document).ready(function () { $('#dataTable').DataTable(); }); }Yogi SRank #511 · 4.8K reputationPosted Jan 26, 2024, 12:33 AM EST
These datatables articles will be helpful to you.
https://www.c-sharpcorner.com/article/create-datatable-in-jquery/
https://www.yogihosting.com/jquery-datatables/