Populating GridView with several data types

2 posts, 0 answers
  1. Avi
    Avi avatar
    2 posts
    Member since:
    Jul 2011

    Posted 31 Oct 2011 Link to this post


    We are developing a new GUI to our system, which is built on top of a legacy code. In details, we write our User Control as a COM (CCW) object that contains the RadGridView and is then placed in the old GUI. The GridView should act mostly in read only mode. Since the communication between the old system and the new system is through the COM interface - it led us to choose the XML populating method to populate our grid. We've sent the XML as a string to the user control. It worked perfectly when we needed only text to be shown in the grid.

    Now, we need to be able to show several types of data and several sub-controls in the grid cells (i.e.: GridViewComboBoxColumn, GridViewCheckBoxColumn, GridViewDecimalColumn, GridViewDateTimeColumn, GridViewImageColumn). The way it works now is:
    (a) Loading the XML into a source DataTable, using ReadXml
    (b) Building a new target DataTable with the needed data types
    (c) Adding the right data columns to the Grid
    (d) Iterating through the source DataTable and copying each cell to the target DataTable
    (e) Assigning the target DataTable to the grid as its Data Source.

    As expected - this process led to performance issues...

    So, we would like to know if our solution is correct? Is there another way to populate the grid under our limitations?
    (Even if we bypass the process of building the XML in the legacy system, and accessing the DB directly, we still need to iterate through all the cells and copying them)



  2. Julian Benkov
    Julian Benkov avatar
    1135 posts

    Posted 02 Nov 2011 Link to this post

    Hello Avi,

    To improve the performance of your application you can load the data from XML in DataTable and bind to RadGridView control directly and copy the data to additional DataTable. Another solution is to serialize data to some binary stream and then load to IBindingList<> collection and bind this collection to RadGridView control.

    I hope this information is useful. Let me know if you need further assistance.

    Julian Benkov
    the Telerik team

    Q2’11 SP1 of RadControls for WinForms is available for download (see what's new); also available is the Q3'11 Roadmap for Telerik Windows Forms controls.

Back to Top