SelectedDate not updated unless user tabs out of box

4 posts, 1 answers
  1. Mark
    Mark avatar
    12 posts
    Member since:
    Apr 2008

    Posted 20 Jul 2009 Link to this post

    The selected date property is not updated when a user types a date into the textbox area of the control and then clicks a submit button.  The user must tab out of the control in order for the selectedDate property to reflect what was entered.  I could find no property that reliably gets me what was entered. 
    I downloaded and update to the 2009 Q2 controls today and the same behavior is present.
    This appears to be a bug.  Suggestions? 

    Thanks.
    Mark
  2. Kaloyan
    Admin
    Kaloyan avatar
    920 posts

    Posted 23 Jul 2009 Link to this post

    Hello Mark,

    Sorry for the late response. We have tried to reproduce the described issue but without a success. As an additional the RadDatePicker control may not update the date value due to not correct Date setting in the Textblok. You can also share with us some simple code, including the problem. So we will be able to define the real situation.
    Also try downloading the latest internal build and check if the problem is still appearing.

    Best wishes,
    Kaloyan
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. DevCraft banner
  4. Mark
    Mark avatar
    12 posts
    Member since:
    Apr 2008

    Posted 23 Jul 2009 Link to this post

    A clarification:  The condition occurs when the raddatepicker is in an collapsed section of the page that is then made visible in response to some action (e.g. a button click).  In the now visible panel, changing the date value by typing and clicking the update button does not update the selected date.  you have to click the button a second time or you had to tab out of the control before clicking the update button.  For some reason, there is no way for me to upload my sample project.  So here's the xaml and code behind.

    <

     

    UserControl xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls" x:Class="ShowRadDatePickerProblem.MainPage"

     

     

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

     

     

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

     

     

    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

     

     

    xmlns:input="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Input"

     

     

    mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480">

     

     

     

    <Grid x:Name="LayoutRoot">

     

     

     

    <StackPanel Background="AliceBlue" HorizontalAlignment="Center" Orientation="Vertical">

     

     

     

    <input:RadDatePicker x:Name="rdpExpDate" Width="150" Height="24" HorizontalAlignment="Left" DisplayMode="MonthView" ></input:RadDatePicker>

     

     

     

    <TextBlock Text="Enter a date, don't tab out, but click submit. Then enter a date, tab out, click submit. All works." Foreground="Black"></TextBlock>

     

     

     

    <Button x:Name="submit" Content="Submit" Click="submit_Click" Width="150"></Button>

     

     

     

    <TextBlock x:Name="txtResult" FontSize="14" Text="Selected Date In Textbox: " Foreground="Black"></TextBlock>

     

     

     

    <TextBlock Text="Now click the show hidden grid button and try the same operations. You have to click the update button twice for the value to change or tab out." Foreground="Black"></TextBlock>

     

     

     

    <Button x:Name="btnShowHiddenGrid" Content="Show Hidden Grid" Width="150" Click="btnShowHiddenGrid_Click"></Button>

     

     

     

    </StackPanel>

     

     

     

    <Border x:Name="borderSelectedItem" Visibility="Collapsed" Margin="3,3,3,3" CornerRadius="10" Grid.Column="0" Grid.Row="2" Canvas.Left="200" Canvas.Top="200" Width="400" Height="200" Background="AntiqueWhite">

     

     

     

    <Grid x:Name="gridSelectedItem" Margin="3,1,3,1">

     

     

     

    <Grid.RowDefinitions>

     

     

     

    <RowDefinition Height="34"></RowDefinition>

     

     

     

    <RowDefinition Height="30"></RowDefinition>

     

     

     

    <RowDefinition Height="30"></RowDefinition>

     

     

     

    <RowDefinition Height="30"></RowDefinition>

     

     

     

    <RowDefinition Height="30"></RowDefinition>

     

     

     

    <RowDefinition Height="30"></RowDefinition>

     

     

     

    </Grid.RowDefinitions>

     

     

     

    <Grid.ColumnDefinitions>

     

     

     

    <ColumnDefinition Width="150"></ColumnDefinition>

     

     

     

    <ColumnDefinition Width="*"></ColumnDefinition>

     

     

     

    </Grid.ColumnDefinitions>

     

     

     

    <Border CornerRadius="5" Margin="3,2,3,1" Background="CadetBlue" Grid.Row="0" Grid.ColumnSpan="2" Grid.Column="0" Height="24" >

     

     

     

    <TextBlock x:Name="Title2" Foreground="Azure" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="12" Text="Edit Date Test"></TextBlock>

     

     

     

    </Border>

     

     

     

    <TextBlock x:Name="txtEffDate" Text="Effective Date" Height="24" Grid.Row="2" Grid.Column="0" FontSize="12" Margin="10,0,0,0"></TextBlock>

     

     

     

    <input:RadDatePicker x:Name="rdpEffDate2" Width="150" Height="24" HorizontalAlignment="Left" Grid.Row="2" Grid.Column="1" DisplayMode="MonthView" ></input:RadDatePicker>

     

     

     

    <StackPanel Width="390" Height="34" Orientation="Horizontal" HorizontalAlignment="Center" Margin="5,0,0,0" Grid.Row="5" Grid.ColumnSpan="2">

     

     

     

    <Button x:Name="btnUpdateWf" Content="Update" VerticalContentAlignment="Center" Width="85" Height="24" Margin="2,2,10,2" ClickMode="Press" Click="btnUpdateWf_Click"></Button>

     

     

     

    </StackPanel>

     

     

     

    </Grid>

     

     

     

    </Border>

     

     

     

    </Grid>

     

    </

     

    UserControl>

     


    using

     

    System;

     

    using

     

    System.Collections.Generic;

     

    using

     

    System.Linq;

     

    using

     

    System.Net;

     

    using

     

    System.Windows;

     

    using

     

    System.Windows.Controls;

     

    using

     

    System.Windows.Documents;

     

    using

     

    System.Windows.Input;

     

    using

     

    System.Windows.Media;

     

    using

     

    System.Windows.Media.Animation;

     

    using

     

    System.Windows.Shapes;

     

    using

     

    Telerik.Windows.Input;

     

    namespace

     

    ShowRadDatePickerProblem

     

    {

     

    public partial class MainPage : UserControl

     

    {

     

    public MainPage()

     

    {

    InitializeComponent();

    rdpExpDate.SelectedDate =

    DateTime.Today;

     

    }

     

    private void submit_Click(object sender, RoutedEventArgs e)

     

    {

    txtResult.Text =

    "Selected Date In Textbox: " + rdpExpDate.SelectedDate.Value.ToShortDateString();

     

    }

     

    private void btnShowHiddenGrid_Click(object sender, RoutedEventArgs e)

     

    {

    borderSelectedItem.Visibility =

    Visibility.Visible;

     

    rdpEffDate2.SelectedDate =

    DateTime.Today;

     

    }

     

    private void btnUpdateWf_Click(object sender, RoutedEventArgs e)

     

    {

    txtResult.Text =

    "Selected Date In Textbox: " + rdpEffDate2.SelectedDate.Value.ToShortDateString();

     

    }

    }

    }



    Thanks.
    Mark
  5. Answer
    Kaloyan
    Admin
    Kaloyan avatar
    920 posts

    Posted 24 Jul 2009 Link to this post

    Hi Mark,

    The problem is in the ClickMode state of the Update button. When it is set to a press mode the click event is fired when mouse down event arises, which is actually before the update of the RadDatePicker with the correct value. That is why you are not getting the correct selected time.

    Greetings,
    Kaloyan
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top