RadDataGrid

4 posts, 0 answers
  1. Vamshi
    Vamshi avatar
    10 posts
    Member since:
    Jun 2017

    Posted 06 Feb 2018 Link to this post

    When Im using telerik.Xamarinforms.Datagrid. Dll   getting  system. TypeloadException
  2. Lance | Manager Technical Support
    Admin
    Lance | Manager Technical Support avatar
    1168 posts

    Posted 06 Feb 2018 Link to this post

    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
  3. Vamshi
    Vamshi avatar
    10 posts
    Member since:
    Jun 2017

    Posted 07 Feb 2018 in reply to Lance | Manager Technical Support Link to this post

    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..

  4. Lance | Manager Technical Support
    Admin
    Lance | Manager Technical Support avatar
    1168 posts

    Posted 07 Feb 2018 Link to this post

    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
Back to Top