This is a migrated thread and some comments may be shown as answers.
RadDataGrid
3 Answers 86 Views
This is a migrated thread and some comments may be shown as answers.
Vamshi
Top achievements
Rank 1
Vamshi asked on 06 Feb 2018, 06:55 AM
When Im using telerik.Xamarinforms.Datagrid. Dll   getting  system. TypeloadException

3 Answers, 1 is accepted

Sort by
0
Lance | Manager Technical Support
Telerik team
answered on 06 Feb 2018, 05:09 PM
Hi Vamshi,

Unfortunately, the amount of information you've provided isn't enough for me to investigate why you're getting that exception. Can you please reply back with either a runnable demo that reproduces the problem, or the full code that I can use to replicate the problem.

Additionally, we also need to know the specifics about what platform you're targeting (e.g. Android 7.1, min SDK 19, target SDK 25)

Regards,
Lance | Tech Support Engineer, Sr.
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Vamshi
Top achievements
Rank 1
answered on 07 Feb 2018, 11:56 AM

Telerik. XamarinForms . DataGrid dlll version-   2017.3.1103.240

Target android version 7.1

Minimum android     4.0.3

Code: RadDataGrid rdg=new RadDataGrid d () :

  rdg. ItemSource=datatable.

Content=rdg.

We are using all required dlls..

0
Lance | Manager Technical Support
Telerik team
answered on 07 Feb 2018, 05:44 PM
Hi Vamshi,

It appears you are still using the CTP (beta) version of the control from last year. Please update to the official release, 2018.1.202.240 in order to get the new features and improvments made since the preview. 

That said, you have't shared enough of your code, or what version of Xamarin.Forms you are using, so I can't determine what's wrong with your application.  

If I had to guess from the name of your variable, you're using a DataTable (.NET Standard 2.0).  DataGrid doesn't support direct binding to DataTable, you can instead make a List from the table rows, like this:

namespace UsingDataTable.NetStandard
{
    public partial class StartPage : ContentPage
    {
        public StartPage()
        {
            InitializeComponent();
        }
 
        protected override void OnAppearing()
        {
            base.OnAppearing();
             
            var datatable = GetStudentsTable();
             
            var list = new List<Student>();
 
            foreach (DataRow row in datatable.Rows)
            {
                list.Add(new Student
                {
                    Name = (string)row.ItemArray[0],
                    Gpa = (double)row.ItemArray[1]
                });
            }
 
            var dg = new RadDataGrid();
            dg.ItemsSource = list;
 
            this.Content = dg;
        }
         
        private DataTable GetStudentsTable()
        {
            var table = new DataTable();
 
            table.Columns.Add("Name"typeof(string));
            table.Columns.Add("Gpa"typeof(double));
 
            for (int i = 1; i < 5; i++)
            {
                table.Rows.Add($"Student {i}", i);
            }
 
            return table;
        }
    }
 
    public class Student
    {
        public string Name { getset; }
        public double Gpa { getset; }
    }
}



Here's a screenshot at runtime:



If you'd like to see DataTable support, you can submit a feature request here.

Regards,
Lance | Tech Support Engineer, Sr.
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Asked by
Vamshi
Top achievements
Rank 1
Answers by
Lance | Manager Technical Support
Telerik team
Vamshi
Top achievements
Rank 1
Share this question
or