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

RadGridView crashes on Return/Enter

2 Answers 95 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Steffen
Top achievements
Rank 1
Veteran
Steffen asked on 08 Mar 2010, 05:39 PM
Hi,

when hitting return/enter after editing the DateTimePicker's value (its actually enough when it gets keyboard-focus) a System.NullReferenceException is thrown.
repro-code:
namespace RadGridViewFocusBug 
    /// <summary> 
    /// Interaction logic for Window1.xaml 
    /// </summary> 
    public partial class Window1 : Window 
    { 
        public Window1() 
        { 
            InitializeComponent(); 
 
            ObservableCollection<BusinessObject> col = new ObservableCollection<BusinessObject>(); 
            col.Add(new BusinessObject() { Arrival = DateTime.Now }); 
            col.Add(new BusinessObject() { Arrival = DateTime.Now }); 
            col.Add(new BusinessObject() { Arrival = DateTime.Now }); 
 
            this.DataContext = col
        } 
    } 
 
    public class BusinessObject 
    { 
        public DateTime Arrival { get; set; } 
    } 

<Window x:Class="RadGridViewFocusBug.Window1" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" 
    Title="Window1" Height="300" Width="300"
    <Grid> 
        <telerik:RadGridView ItemsSource="{Binding}" AutoGenerateColumns="False"
            <telerik:RadGridView.Columns> 
                <telerik:GridViewDataColumn Header="Arrival" > 
                    <telerik:GridViewColumn.CellTemplate> 
                        <DataTemplate> 
                            <telerik:DateTimePicker SelectedDateTime="{Binding Path=Arrival, Mode=TwoWay}"/> 
                        </DataTemplate> 
                    </telerik:GridViewColumn.CellTemplate> 
                </telerik:GridViewDataColumn> 
            </telerik:RadGridView.Columns> 
        </telerik:RadGridView> 
    </Grid> 
</Window> 

Best Regards
Steffen

2 Answers, 1 is accepted

Sort by
0
Accepted
Nedyalko Nikolov
Telerik team
answered on 11 Mar 2010, 11:11 AM
Hi Steffen,

Could please tell me which version of RadControls causes the problem? I've tried with 2009.3.1314, latest internal build for Q3 and current official release (2010.Q1) and everything works fine on my end. However I could recommend you to change your xaml to something like following in order to get full advantage of RadGridView editing and validation mechanism.

<telerik:RadGridView ItemsSource="{Binding}" AutoGenerateColumns="False">
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn Header="Arrival" DataMemberBinding="{Binding Arrival}">
                    <telerik:GridViewColumn.CellEditTemplate>
                        <DataTemplate>
                            <telerik:DateTimePicker SelectedDateTime="{Binding Path=Arrival, Mode=TwoWay}" />
                        </DataTemplate>
                    </telerik:GridViewColumn.CellEditTemplate>
                </telerik:GridViewDataColumn>
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>


Best wishes,
Nedyalko Nikolov
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.
0
Steffen
Top achievements
Rank 1
Veteran
answered on 11 Mar 2010, 12:23 PM
Hi,
this thread was moved here from 2010Q1-beta-category (I used the beta-dll's).
With the new dll's the problem does not occur anymore.
Thank you for the tip with the CellEditTemplate!

Best Regards
Steffen


Tags
General Discussions
Asked by
Steffen
Top achievements
Rank 1
Veteran
Answers by
Nedyalko Nikolov
Telerik team
Steffen
Top achievements
Rank 1
Veteran
Share this question
or