DataForm and DataTable

16 posts, 0 answers
  1. Aleks
    Aleks avatar
    4 posts
    Member since:
    Nov 2011

    Posted 26 Mar 2012 Link to this post

    I am trying to bind the DataForm ItemsSource to a DataTable. Initially the DataForm is populated, but if I try to navigate through the records, I get an error.

    I have spent past hour searching for a solution, and I could not find any mention of this issue. DataForm works fine if binded to an ObservableCollection of business objects. But in this case I need it binded to a DataTable, and I cant seem to find a way to get it working.

    IDE: VS2010
    .Net Version: 4.0
    Telerik Version: 2011.3.1220.40

    I have created a sample project that recreates the same issue. The error that I receive when navigating through the records is:

    The type 'DataRowView' does not contain a public property named 'DateTime'.
    Parameter name: propertyName


    <Window xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"  x:Class="Testing.DataForm.MainWindow"
            Title="MainWindow" Height="350" Width="525">
        <Grid>
            <telerik:RadDataForm Name="dataForm"/>
        </Grid>
    </Window>

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Data;
    using System.Windows.Documents;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Imaging;
    using System.Windows.Navigation;
    using System.Windows.Shapes;
    using System.Data;
     
    namespace Testing.DataForm
    {
        /// <summary>
        /// Interaction logic for MainWindow.xaml
        /// </summary>
        public partial class MainWindow : Window
        {
     
            public MainWindow()
            {
                InitializeComponent();
                GenerateSomeData();
            }
     
            private void GenerateSomeData()
            {
                #region Data Generator
     
                DataTable baseTable = new DataTable();
                baseTable.Columns.Add("DateTime", typeof(DateTime));
                baseTable.Columns.Add("Value", typeof(decimal));
     
                DateTime date = new DateTime(DateTime.Now.Year, 11, 1);
     
                TimeSpan span = date.AddMonths(1).AddDays(-1) - date;
     
                int numDays = span.Days;
                int randHigh = 65;
                int randLow = 0;
     
                #region RANDOM DATA GENERATOR
     
                Random rand = new Random();
     
     
                int calculatedNumHours = 24 * numDays;
                for (int hour = 1; hour <= calculatedNumHours; hour++)
                {
                    baseTable.Rows.Add(new object[]
                    {
                        date.AddHours(hour).AddSeconds(-1),
                        rand.NextDouble() * ((randHigh - randLow) + randLow)
                    });
                }
     
                #endregion
     
                dataForm.ItemsSource = baseTable.DefaultView;
     
                #endregion
            }
        }
    }
  2. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1128 posts

    Posted 29 Mar 2012 Link to this post

    Hi Aleks,

    Thank you for reporting this to us. We have recently stumbled upon a similar issue with RadDataForm when ItemsSource is bound to a DataTable. We will do our best to implement a fix in 2 weeks and include it in an internal build. I will keep in touch with you, in order to notify you as soon as the mentioned IB is released.

    All the best,
    Ivan Ivanov
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  3. UI for WPF is Visual Studio 2017 Ready
  4. Simon
    Simon avatar
    23 posts
    Member since:
    Apr 2012

    Posted 22 May 2012 Link to this post

    Hello Ivan,

    I am running into the same issue with the RadGridView being bound to a DataTable. I am using build 2012.1.0326.40 of the WPF controls.

    Can you tell us when on in which build this issue will be fixed? Is there a bug report in your public bug tracker so that we can follow the progress?

    Many thanks,

    Simon
  5. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1128 posts

    Posted 23 May 2012 Link to this post

    Hello Simon,

    Would you please test this with our latest internal build - 2012.1.521 and tell us whether the problem persists on your side?

    Kind regards,
    Ivan Ivanov
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
  6. Simon
    Simon avatar
    23 posts
    Member since:
    Apr 2012

    Posted 23 May 2012 Link to this post

    Hello Ivan,

    I will try the build as soon as I have a chance and will report on the result.

    Thanks,

    Simon
  7. Simon
    Simon avatar
    23 posts
    Member since:
    Apr 2012

    Posted 14 Jun 2012 Link to this post

    Hello Ivan,

    Unfortunately, I have tried build number 2012.1.528.40 and am experiencing the same exception.

    Please advise,

    Many thanks,

    Simon
  8. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 15 Jun 2012 Link to this post

    Hello Simon,

     May I ask you to check what the behaviour is with the binaries from the latest release - Q2 2012? Would you please confirm if you use a code similar to the code posted when this thread was opened?

    Regards,
    Didie
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  9. Joel Palmer
    Joel Palmer avatar
    164 posts
    Member since:
    May 2009

    Posted 10 Dec 2012 Link to this post

    Do you have a working example of this with a DataSet as the back end now that you have fixes in?   I'm on 2012 Q3.
  10. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 11 Dec 2012 Link to this post

    Hi,

    We have a similar issue still logged into our system for fixing, so probably the issue was not fixed. We will re-evaluate the issue and hopefully we will be able to fix it.
     

    Kind regards,
    Didie
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  11. Joel Palmer
    Joel Palmer avatar
    164 posts
    Member since:
    May 2009

    Posted 11 Dec 2012 Link to this post

    What type of collection currently works?  I'd like to use this so I may just reload the tables into an object.  Does this work with a collection of dynamic objects?
  12. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1128 posts

    Posted 14 Dec 2012 Link to this post

    Hello,

    We will try to provide a fix for this issue in some of our future internal builds. As for the dynamics, RadDataForm supports them. I have prepared a very basic project to demonstrate.

    All the best,
    Ivan Ivanov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  13. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1128 posts

    Posted 23 Jan 2013 Link to this post

    Hi,

    We have committed a fix for the logged issue. It will be available with the next internal build. I hope that it will solve your problem too.

    All the best,
    Ivan Ivanov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  14. Sheetal
    Sheetal avatar
    5 posts
    Member since:
    Oct 2013

    Posted 31 Oct 2013 Link to this post

    Hi,

     I have the recent version of Telerik controls purchased last week. I am trying to bind datatable with radgridview and raddataform. However, when I select particular row in the radgridview, the row is not changed/selected in the raddataform below. Is there any property that we need to set? I went through the demos but it does not show any example using datatable but only collectionview. I also need some fields to be comboboxes which is not possible by binding with datatable. Is there any example where we can convert the datatable into collectionview with classes having enums, etc. as shown in the demo?
  15. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 31 Oct 2013 Link to this post

    Hello,

    You should set the RadGridView.ItemsSource/RadDataForm.ItemsSource to a DataTable.DefaultView.

    Regards,
    Didie
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  16. Sheetal
    Sheetal avatar
    5 posts
    Member since:
    Oct 2013

    Posted 31 Oct 2013 Link to this post

    Yes, but that doesnt allow for both Radgridview and Raddataform to work in sync for selection. If row is selected in Radgridview, that row is not selected in raddataform below. Is there any property that we need to set?
  17. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 31 Oct 2013 Link to this post

    Hello,

    You should set the CurrentItem for the DataForm to be the SelectedItem in RadGridView. That way the selection for both the controls will be synchronized.

    You can also check our online documentation here.

    Regards,
    Didie
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top
UI for WPF is Visual Studio 2017 Ready