This is a migrated thread and some comments may be shown as answers.

Initializing Grid to a List<Class>

1 Answer 127 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Nicholas
Top achievements
Rank 1
Nicholas asked on 16 Jul 2014, 05:07 PM
I'm Quite new to Telerik, kendo, and HTML(great start, I know), but I'm developing a WebApplication that will disply Oracle - queried data. I am able to bring in the data from a c# class which has the form List<class> where the class has a couple strings and decimals. My question is how can I initialize this list into the grid?, I'm assuming I need to use a script like this:

    <script>
        $(document).ready(function () {

            $("#grid").kendoGrid({
                height: 550,
                groupable: true,
                sortable: true,
                pageable: {
                refresh: true,
                pageSizes: true,
                buttonCount: 5
                },
                dataSource: {

                }
                
            });
        });
    </script>


-------------------------------------------------------
This is now I initialized by table:
<table id="grid">
        <colgroup>
            <col />
            <col />
            <col style="width:110px" />
            <col style="width:120px" />
            <col style="width:130px" />
        </colgroup>
        <thead>
            <tr>
                <th data-field="make">Field a</th>
                <th data-field="model">Field b</th>
                <th data-field="year">Field c</th>
                <th data-field="category">Field d</th>
                <th data-field="airconditioner">Field e</th>
            </tr>
        </thead>
        <tbody>
 
        </tbody>
    </table>

------------------------------------------------------------
And i bring in my List<Class> like this:

@{
    var info = new DB();
    List<class> data = info.getdata(); //Where info.getdata() is a function of the DB that returns the list<class> of data
 }

1 Answer, 1 is accepted

Sort by
0
Vladimir Iliev
Telerik team
answered on 18 Jul 2014, 08:10 AM
Hi Nicholas,

As it seems that the application is build using MVC (and Razor view engine) I would suggest to implement Controller Action which to return the data formatted using ToDataSourceResult extension method and consume it using the Telerik UI for ASP.NET MVC Grid wrapper on the client side. For more information you can check the following additional information: Regards,
Vladimir Iliev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Nicholas
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
Share this question
or