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

Directly typing in the time

6 Answers 85 Views
TimePicker
This is a migrated thread and some comments may be shown as answers.
Terry
Top achievements
Rank 1
Terry asked on 19 Jun 2010, 12:09 AM
As long as I pick a time from the dropdown, everything works OK, but in the RowValidating event, if I type a time directly into the textbox and then click on another row, the e.Row.DataContext still has the old value.  However, if I tab to the next column, the value is updated.

I think this is a bug.  The DataContext should update, no matter how you exit the cell, prior to the RowValidating event.

So, to give you a specific example, here is my RowValidating code:

        private void gvTimeSheet_RowValidating( object sender, GridViewRowValidatingEventArgs e )  
        {  
            ChargeInfo chg = e.Row.DataContext as ChargeInfo;  
 
            // require end time > starttime and <= 12 hours  
            // OK to roll over to next day  
            TimeSpan ts = chg.EndTimeSpan - chg.StartTimeSpan;  
            if ( ts == new TimeSpan( 0, 0, 0 ) )  
            {  
                MessageBox.Show( "Start time cannot equal end time" );  
                e.IsValid = false;  
                return;  
            }  
            else if ( ts < new TimeSpan( -12, 0, 0 )  || ts > new TimeSpan( 12, 0, 0 ) )  
            {  
                MessageBox.Show( "Individual time charges > 12 hours are not allowed." );  
                e.IsValid = false;  
                return;  
            }  
        }  
 
 

If I edit a row with an 11:00 AM start time and a 1:00 PM end time, changing the end time to 11:01 PM, I should get an error message since the elapsed time is greater than 12 hours, but if I exit the end time field by clicking on another row in the same column, the end time in the DataContext is still 1:00 PM and no error is triggered.  If I come back to the row to edit it again, the DataContext and the underlying binding have the new invalid time, 11:01 PM.

How can I resolve this problem?

Thanks,

Terry 
 

6 Answers, 1 is accepted

Sort by
0
Terry
Top achievements
Rank 1
answered on 19 Jun 2010, 12:36 AM
Another thing I just noticed:  When I revise a time by directly editing the textbox and then tab to the next field, the old value is displayed.  When I click back into the time textbox to put it in edit mode, the new value is then displayed. 

Here's what the xaml for the time columns looks like:

                    <!-- Start Time --> 
                    <radGridView:GridViewDataColumn Header="Start Time" 
                        DataMemberBinding="{Binding StartTimeSpan, Mode=TwoWay}">  
                        <radGridView:GridViewDataColumn.CellTemplate> 
                            <DataTemplate> 
                                <TextBlock Text="{Binding StartTimeSpan, Converter={StaticResource TimeSpanToStringConverter}}" /> 
                            </DataTemplate> 
                        </radGridView:GridViewDataColumn.CellTemplate> 
                        <radGridView:GridViewDataColumn.CellEditTemplate> 
                            <DataTemplate> 
                                <radInput:RadTimePicker TimeInterval="0:15:0"     
                                     SelectedTime="{Binding StartTimeSpan, Mode=TwoWay}" /> 
                            </DataTemplate> 
                        </radGridView:GridViewDataColumn.CellEditTemplate> 
                    </radGridView:GridViewDataColumn> 
                      
                    <!-- End Time --> 
                    <radGridView:GridViewDataColumn Header="End Time" 
                        DataMemberBinding="{Binding EndTimeSpan, Mode=TwoWay}">  
                        <radGridView:GridViewDataColumn.CellTemplate> 
                            <DataTemplate> 
                                <TextBlock Text="{Binding EndTimeSpan, Converter={StaticResource TimeSpanToStringConverter}}" /> 
                            </DataTemplate> 
                        </radGridView:GridViewDataColumn.CellTemplate> 
                        <radGridView:GridViewDataColumn.CellEditTemplate> 
                            <DataTemplate> 
                                <radInput:RadTimePicker TimeInterval="0:15:0"     
                                     SelectedTime="{Binding EndTimeSpan, Mode=TwoWay}" /> 
                            </DataTemplate> 
                        </radGridView:GridViewDataColumn.CellEditTemplate> 
                    </radGridView:GridViewDataColumn> 
                     
 
0
Kaloyan
Telerik team
answered on 24 Jun 2010, 12:32 PM
Hi Terry,

Could you specify the version of our controls that is leading you to this problem.

Greetings,
Kaloyan
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
Terry
Top achievements
Rank 1
answered on 24 Jun 2010, 04:15 PM
Hi Kaloyan:

We're using Silverlight 4 with version is 2010.1.412.1040.
0
George
Telerik team
answered on 30 Jun 2010, 09:56 AM
Hello Terry,

Thank you for contacting us.

All our attempts to reproduce the problem failed. If you could send us a sample running project that reproduces the problem will be really helpful.

I will be glad to assist you further.

Sincerely yours,
George
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
Terry
Top achievements
Rank 1
answered on 30 Jun 2010, 06:19 PM
Actually, we recently upgraded to v 2010.1.603.1040 and the problem went away.  Thanks for your help.

Terry
0
George
Telerik team
answered on 01 Jul 2010, 05:17 PM
Hello Terry,

I am glad that the issue you were facing is now resolved. Please do not hesitate to contact us if you have any additional questions.

It was pleasure for me to assist you. Wish you a great day.

Regards,
George
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
Tags
TimePicker
Asked by
Terry
Top achievements
Rank 1
Answers by
Terry
Top achievements
Rank 1
Kaloyan
Telerik team
George
Telerik team
Share this question
or