Telerik Silverlight Datatable

4 posts, 0 answers
  1. George Fryberger
    George Fryberger avatar
    6 posts
    Member since:
    May 2009

    Posted 31 Aug 2010 Link to this post

    I need to be able to serialize the class that can be found on this Telerik blog.

    Download Class

    I am trying to do this from within a Silverlight project to cache the data to the IsolatedStorageFile using the XMLSerializer.  The problem that I am having is that I am getting an error message stating

    To be XML serializable, types which inherit from IEnumerable must have an implementation of Add(System.Object) at all levels of their inheritance hierarchy. Telerik.Data.DataTable does not implement Add(System.Object).

    I have been trying to modify the class to include an "Add" method but I have been unable to get it to work and I am uncertain as to what I am doing wrong.

    I know that this is only loosely related to Telerik and their products, but I would greatly appreciate any assistance that anyone can provide.
  2. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 07 Sep 2010 Link to this post

    Hi,

     You may need to change a bit our DataTable to be IList instead IEnumerable. You can find our latest code here

    Regards,
    Vlad
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items
  3. Italcoppie Sensori S.R.L.
    Italcoppie Sensori S.R.L. avatar
    1 posts
    Member since:
    Mar 2007

    Posted 27 May 2011 Link to this post

    Hi, when I click on btnTest button to add a column to my datatable, I receive this error message:

     

     

    "Collection is read-only."
    Could you help me plese? Below you can see my snipped code.
    Thanks

    DataTable
    dt = null ;
     
     

     

     

    public ucTab01() 

     

    InitializeComponent(); 

     

    GetDT();
    }

     

     

     

     

     

    void 

     

     

    GetDT()  

    {

     

     

    dt = new DataTable(); 

    dt.Columns.Add(new DataColumn() { ColumnName = "Col1", DataType = typeof(string) });
    DataRow row = dt.NewRow(); 

     

     

    row["Col1"] = "test";

     

     

    dt.Rows.Add(row);

     

     

    this.RadGridView01.ItemsSource = dt.ToList();

     

    }
     
     

     

     

     

    private void btnTest_Click(object sender, RoutedEventArgs

    e) 

    {

     

    dt.Columns.Add(

     

    new DataColumn() { ColumnName = "Col2", DataType = typeof(decimal

    ) }); //This is my ERROR!

     

    }

     

     

  4. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 01 Jun 2011 Link to this post

    Hello,

    Indeed, once the DataTable is set as the ItemsSource for the grid, its Columns collection gets read-only. What you may try to do is to create a new one with the same data plus the additional column that you want and set this new DataTable as data source for the RadGridView. 

    Regards,
    Maya
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items
Back to Top