Directly typing in the time

7 posts, 0 answers
  1. Terry
    Terry avatar
    157 posts
    Member since:
    Jul 2009

    Posted 18 Jun 2010 Link to this post

    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 
     
  2. Terry
    Terry avatar
    157 posts
    Member since:
    Jul 2009

    Posted 18 Jun 2010 Link to this post

    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> 
                         
     
  3. DevCraft banner
  4. Kaloyan
    Admin
    Kaloyan avatar
    920 posts

    Posted 24 Jun 2010 Link to this post

    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
  5. Terry
    Terry avatar
    157 posts
    Member since:
    Jul 2009

    Posted 24 Jun 2010 Link to this post

    Hi Kaloyan:

    We're using Silverlight 4 with version is 2010.1.412.1040.
  6. George
    Admin
    George avatar
    1332 posts

    Posted 30 Jun 2010 Link to this post

    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
  7. Terry
    Terry avatar
    157 posts
    Member since:
    Jul 2009

    Posted 30 Jun 2010 Link to this post

    Actually, we recently upgraded to v 2010.1.603.1040 and the problem went away.  Thanks for your help.

    Terry
  8. George
    Admin
    George avatar
    1332 posts

    Posted 01 Jul 2010 Link to this post

    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
Back to Top
DevCraft banner