RadDateTimePicker in edit mode

2 posts, 1 answers
  1. Jugoslav
    Jugoslav avatar
    72 posts
    Member since:
    Mar 2011

    Posted 16 Jul 2012 Link to this post

    I have a RadDateTimePicker which in edit mode you may want to set text to nothing e.g. select the date string and press delete button on your keyboard. However the date is still present so i can't find out if user has deleted the text or not. How do i do that?

    Basically i need to find out if RadDateTimePicker.Text = String.Empty and set the SqlParameter value to DbNull.Value

    Thank you so much
  2. Answer
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 17 Jul 2012 Link to this post


    You can access the RadDateTimePicker in ItemDataBound event as shown below.
    protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
     if (e.Item is GridEditableItem && e.Item.IsInEditMode)
       GridEditableItem item = e.Item as GridEditableItem;
       RadDateTimePicker pkr = (RadDateTimePicker)item.FindControl("RadDateTimePicker1");
       if (pkr.SelectedDate.ToString() == string.Empty)
         //set date here

Back to Top