This is a migrated thread and some comments may be shown as answers.

DataForm and DataTable

15 Answers 195 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
Aleks
Top achievements
Rank 1
Aleks asked on 26 Mar 2012, 03:31 PM
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
        }
    }
}

15 Answers, 1 is accepted

Sort by
0
Ivan Ivanov
Telerik team
answered on 29 Mar 2012, 10:44 AM
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 >>
0
Simon
Top achievements
Rank 1
answered on 22 May 2012, 06:14 PM
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
0
Ivan Ivanov
Telerik team
answered on 23 May 2012, 09:17 AM
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 >>
0
Simon
Top achievements
Rank 1
answered on 24 May 2012, 01:06 AM
Hello Ivan,

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

Thanks,

Simon
0
Simon
Top achievements
Rank 1
answered on 14 Jun 2012, 11:47 PM
Hello Ivan,

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

Please advise,

Many thanks,

Simon
0
Dimitrina
Telerik team
answered on 15 Jun 2012, 07:08 AM
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 >>

0
Joel Palmer
Top achievements
Rank 2
answered on 10 Dec 2012, 07:22 PM
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.
0
Dimitrina
Telerik team
answered on 11 Dec 2012, 04:18 PM
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.

0
Joel Palmer
Top achievements
Rank 2
answered on 11 Dec 2012, 05:15 PM
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?
0
Ivan Ivanov
Telerik team
answered on 14 Dec 2012, 05:30 PM
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.

0
Ivan Ivanov
Telerik team
answered on 23 Jan 2013, 12:20 PM
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.

0
Sheetal
Top achievements
Rank 1
answered on 31 Oct 2013, 09:40 AM
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?
0
Dimitrina
Telerik team
answered on 31 Oct 2013, 01:36 PM
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 >>
0
Sheetal
Top achievements
Rank 1
answered on 31 Oct 2013, 03:22 PM
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?
0
Dimitrina
Telerik team
answered on 31 Oct 2013, 04:33 PM
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 >>
Tags
DataForm
Asked by
Aleks
Top achievements
Rank 1
Answers by
Ivan Ivanov
Telerik team
Simon
Top achievements
Rank 1
Dimitrina
Telerik team
Joel Palmer
Top achievements
Rank 2
Sheetal
Top achievements
Rank 1
Share this question
or