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

Problem setting the default values to the GridViewDataColumn (Date Column).

0 Answers 106 Views
GridView
This is a migrated thread and some comments may be shown as answers.
SivaPrasad Bevara
Top achievements
Rank 1
SivaPrasad Bevara asked on 23 May 2012, 02:57 PM

Hi,

I am using Telerik controls for Silverlight 5.

I have a custom DataGridDatePickerColumn class which inherits the GridViewDataColumn.
I am using this column to load the date values in the Grid. I wanted to set default values to this column in the add mode.

For this I have added a dependency property as below.

public DateTime GridColumnDefaultValue
        {
            get { return (DateTime)GetValue(GridColumnDefaultValueProperty); }
            set { SetValue(GridColumnDefaultValueProperty, value); }
        }
         
public static readonly DependencyProperty GridColumnDefaultValueProperty =
                                DependencyProperty.Register("GridColumnDefaultValue", typeof(DateTime), typeof(DataGridDatePickerColumn), null); 

I am setting this GridColumnDefaultValue in the Grid and using this in the "AddingNewDataItem" event to set the defalut values.

I am setting the default value as below.

<MyControls:DataGridDatePickerColumn x:Name="close_date" GridColumnDefaultValue="12/12/1989" DataMemberBinding="{Binding CLOSE_DATE, Converter={StaticResource DateConverter}}" Header="Close Date" Width="110"></MyControls:DataGridDatePickerColumn>

But I am getting the following error while loading the Grid.
Failed to create a 'System.DateTime' from the text '12/12/1989'

I am using the similar way for setting the default values in the "GridViewTextBoxColumn" and that is working well.

Please help.

Regards,
SivaPrasad.B

 

No answers yet. Maybe you can help?

Tags
GridView
Asked by
SivaPrasad Bevara
Top achievements
Rank 1
Share this question
or