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

Populate Grid from Model

2 Answers 229 Views
Grid
This is a migrated thread and some comments may be shown as answers.
const
Top achievements
Rank 2
Veteran
const asked on 15 Jun 2020, 05:42 PM

Hello,

 

I'm having the List of <Model> which is populated by call to database:

    private List<OrdersModel> orders;

    protected override async Task OnInitializedAsync()
    {
        orders = await _db.GetOrders();

    }

How do I fill Grid with orders info?

This is how my Model looks like:

    public class OrdersModel
    {
        public string OrdNo { get; set; }

         public string OrdStatus { get; set; }

    }

 

Please advise.

2 Answers, 1 is accepted

Sort by
0
Accepted
Marin Bratanov
Telerik team
answered on 15 Jun 2020, 07:36 PM

Hi,

You just point the Data parameter of the grid to the orders collection. You can find an example here: https://docs.telerik.com/blazor-ui/components/grid/overview. You can also scroll a little down to the "Data Binding" section for more details, examples and links.

If you don't want to define the columns yourself, you can have the grid generate them for you: https://docs.telerik.com/blazor-ui/components/grid/columns/auto-generated.

 

Regards,
Marin Bratanov
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
const
Top achievements
Rank 2
Veteran
answered on 16 Jun 2020, 01:21 AM
Figured it out, thank you!
Tags
Grid
Asked by
const
Top achievements
Rank 2
Veteran
Answers by
Marin Bratanov
Telerik team
const
Top achievements
Rank 2
Veteran
Share this question
or