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

[Solved] Binding RadGridView for Winforms error

2 Answers 53 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
James
Top achievements
Rank 1
James asked on 22 Nov 2010, 04:19 PM

I followed the video and typed the code as displayed:

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

namespace WindowsFormsApplication1

{

    public partial class Form1 : Form

    {

        public Form1()

        {

            InitializeComponent();

        }

        private void Form1_Load(object sender, EventArgs e)

        {

            AdventureWorksEntityDiagrams entities = new AdventureWorksEntityDiagrams();

            radGridView1.DataSource =entities.Products;

        }

    }

}

I get the following error:
The type initializer for 'TelerikBinding.AdventureWorksLTEntityDiagrams' threw an exception.

Any ideas why?

2 Answers, 1 is accepted

Sort by
0
James
Top achievements
Rank 1
answered on 22 Nov 2010, 04:26 PM
I am not using data services. I followed the example in your video. The project is very simple.

Add a Telerik OpenAccess Domain Model to project
Setup for Adventureworks
Drop a datagridview on form
Add following 2 lines of code to Form1_Load event
AdventureWorksEntityDiagrams entities = new AdventureWorksEntityDiagrams();
radGridView1.DataSource =entities.Products;

That's it.
0
Alexander
Telerik team
answered on 24 Nov 2010, 04:20 PM
Hi James,

I suspect that the connection string needed for your domain model is missing from the App.config file of the WinForms project. Could you please verify if this is the case and copy the appropriate connection string? If this is not the case, please send us the whole exception message, hopefully it would lead us to the problem.

Greetings,
Alexander
the Telerik team
Accelerate your learning with industry's first Telerik OpenAccess ORM SDK. Download today.
Tags
General Discussions
Asked by
James
Top achievements
Rank 1
Answers by
James
Top achievements
Rank 1
Alexander
Telerik team
Share this question
or