Last post Jun 14, 2019 07:27 AM by Jenifer Jiang
Jun 13, 2019 07:30 PM|UOKSoftware|LINK
I'm working on a view and I have a few questions for completing my task. I want to make an expandable data grid. In web forums I could just drag & drop the data grid controller and set the source to the data table. But MVC of course is different. So how
do I do this in MVC? Here is my current code:
<div class="title-bar">My Products</div>
<div class="title-bar-body" id="My_Products">
<table class="table-high-scores" align="center">
Here is what the page/view looks like for users currently:
page will load first and this data can load & populate later. If that makes sense.
Jun 13, 2019 07:46 PM|mgebhard|LINK
First, you need to stop using DataTables.
MVC uses Models. Model is part of the acronym not DataTable.
Once you craft a Model which is just a class then you can take advantage of MVC scaffolding. Right click on any controller action and select Add View... A wizard pops up where you can select a Template type; Create, Edit, List, etc and a Model which
creates a strongly typed View.
If you are using Entity Framework then you can create a CRUD Controller and associated Views in one shot.
These concepts are covered in the getting started docs.
Jun 13, 2019 09:06 PM|UOKSoftware|LINK
Jun 14, 2019 07:27 AM|Jenifer Jiang|LINK
According to your description, I have several concerns.
Do you mean that you have use datatable to define the data which will populate on the page?
Could you please how is your passing data defined?
'd like this to load async in the background so the page will load first and this data can load & populate later.
Do you mean that you want to load the table with delay?
In my opinion, I suggest that you could use ajax to load the data on your page.
You could define a function to return the data in your controller.(And it is encouraged to use List<> to create your data)
Then use .$get() to get the data to show.
Here is a perfect tutorial video you may refer to: How to display table data from database in Asp.net MVC using Jquery Ajax