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

RadDateTimePicker in edit mode

1 Answer 57 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jugoslav
Top achievements
Rank 1
Jugoslav asked on 16 Jul 2012, 11:13 PM
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

1 Answer, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 17 Jul 2012, 05:25 AM
Hello,

You can access the RadDateTimePicker in ItemDataBound event as shown below.
C#:
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
   }
 }
}

Thanks,
Shinu.
Tags
Grid
Asked by
Jugoslav
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or