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

GridViewDateTimeColumn

14 Answers 304 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Louis
Top achievements
Rank 1
Louis asked on 01 Oct 2007, 03:05 PM
Why is the GridViewDateTimeColumn not showing like the raddatetimepicker ?

How can i put a raddatetimepicker in a column?

14 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 02 Oct 2007, 09:27 AM
Hello Louis ,

You cannot put a RadDateTimePicker in RadGridView at this moment. The RadDateTimePicker is not a stand alone control - rather, it was developed to be a plug in module for RadCalendar. Once we provide RadDateTimePicker as a separate control with example and documentation, we will include an example of it with RadGridView.

 

Best wishes,
Peter
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Lovsten
Top achievements
Rank 1
answered on 04 Oct 2007, 09:16 AM
For your info Louise. The RadDateTimePicker isn't currently a datetimepicker, it's a DatePickerDateTimeShower (no way for the user to edit the time part). See my post under RadCalender. 
0
Jose Monerto
Top achievements
Rank 1
answered on 12 Jan 2010, 07:33 PM
How can quit DatePickerDateTimeShower or how can selecting automatic date without clicking the control DatePickerDateTimeShower

regards
0
Jack
Telerik team
answered on 13 Jan 2010, 09:32 AM
Hi Jose,

I am not sure that I understand your question. There is help article in our online help documentation describing how to customize the date time column. In addition you can use GridViewMaskBoxColumn for date time input:

GridViewMaskBoxColumn maskColumn = new GridViewMaskBoxColumn("Date");
maskColumn.MaskType = MaskType.DateTime;
maskColumn.Mask = "d";
this.radGridView1.Columns.Add(maskColumn);

I hope this helps. If you need further assistance, please write back and describe the desired behavior in detail.

Regards,
Jack
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Jose Monerto
Top achievements
Rank 1
answered on 13 Jan 2010, 06:44 PM
How Can I disable the DatePickerDateTimeShower control or how can I select automaticly the data without make a click in the control for select the data date without clicking the control DatePickerDateTimeShower
0
Jack
Telerik team
answered on 15 Jan 2010, 08:43 AM
Hi Jose Monerto,

Just set the ReadOnly property of the column to true if you want to disable the editor. If you want to hide the popup of the editor, please consider the code snippet below:

void radGridView1_CellBeginEdit(object sender, GridViewCellCancelEventArgs e)
{
    RadDateTimeEditor editor = this.radGridView1.ActiveEditor as RadDateTimeEditor;
    if (editor != null)
    {
        RadDateTimeEditorElement editorElement = editor.EditorElement as RadDateTimeEditorElement;
        editorElement.ShowUpDown = true;
    }
}

As to the second part of your question, the user cannot select a date before first clicking in a RadDateTimeEditor (our date time editor). Please describe your scenario in detail and I will be glad to assist you.

Regards,

Jack
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Jose Monerto
Top achievements
Rank 1
answered on 15 Jan 2010, 04:39 PM
Well, How I can make to save the value of the raddatatimepicker without make a click, or to select the value of this, doing "TAB" or "ENTER" in the keyboard just  for have a better capture way from the user?

thk, regards
0
Jack
Telerik team
answered on 18 Jan 2010, 08:27 AM
Hi Jose Monerto,

You can get the current value of a date time picker by using ActiveEditor.Value property and you can save it by calling EndEdit method. In all cases, you need some interaction from the user to save the value. In RadGridView this happens when you click on a different cell or when you navigate with the keyboard (by using Tab, Left, Right keys for example). The editor saves its value also when pressing the Enter key. If you expect different behavior, please describe it in detail and I will be glad to help.

Sincerely yours,

Jack
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Wojtek Victor
Top achievements
Rank 1
answered on 08 Feb 2017, 10:51 PM

Hi Jack. I'm having issues with the RadDateTimeEditor in my RadGridView. I'm using the UI for WinForm (v.2017.1.117.40). In my RadGridView, I have standard number editors, text only editors and datetime editors that come standard when data filling my radgridview.

When I start editing my columns, let's say I edit my number column, then I press the TAB key, the value I put in stayed in the column. Same for my text only columns. But when I get to my datetime editor and press TAB (or ENTER), the value disappears. But when I click out, it's saved. I don't have any cell validating event on key press. Can you replicate this problem?

0
Wojtek Victor
Top achievements
Rank 1
answered on 08 Feb 2017, 10:55 PM
[quote]Wojtek Victor said:

Hi Jack. I'm having issues with the RadDateTimeEditor in my RadGridView. I'm using the UI for WinForm (v.2017.1.117.40). In my RadGridView, I have standard number editors, text only editors and datetime editors that come standard when data filling my radgridview.

When I start editing my columns, let's say I edit my number column, then I press the TAB key, the value I put in stayed in the column. Same for my text only columns. But when I get to my datetime editor and press TAB (or ENTER), the value disappears. But when I click out, it's saved. I don't have any cell validating event on key press. Can you replicate this problem?

[/quote]

I forgot to mention that this behavior only happens in the "add new row" line of the RadGridView.

0
Dimitar
Telerik team
answered on 09 Feb 2017, 08:51 AM
Hi Victor,

I cannot reproduce this locally. I have attached a small video that shows how I am testing this. What else I need to do in order to reproduce it?

I am looking forward to your reply.

Regards,
Dimitar
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Wojtek Victor
Top achievements
Rank 1
answered on 09 Feb 2017, 06:44 PM

Thanks for the quick reply. I've narrowed the problem down. I want to change the masktype of the RadDateTimeEditor to FreeFormDateTime. And since I did that, the TAB and ENTER buttons don't work anymore inside that cell. Here's the code I'm using.

private void FilterableDataGrid_CellEditorInitialized(object sender, GridViewCellEventArgs e)
{
    var radDateTimeEditor = _filterableDataGrid.ActiveEditor as RadDateTimeEditor;
    if (radDateTimeEditor == null) return;
 
    var radDateTimeEditorElement = (RadDateTimeEditorElement)radDateTimeEditor.EditorElement;
 
    var radDateTimePickerCalendar = radDateTimeEditorElement.GetCurrentBehavior() as RadDateTimePickerCalendar;
    if (radDateTimePickerCalendar == null) return;
 
    var radDateTimePickerElement = radDateTimePickerCalendar.DateTimePickerElement;
    radDateTimePickerElement.Format = DateTimePickerFormat.Custom;
 
    var radMaskedEditBoxElement = radDateTimePickerCalendar.TextBoxElement;
     
    radMaskedEditBoxElement.EnableNullValueInput = true;
    radMaskedEditBoxElement.MaskType = MaskType.FreeFormDateTime;
 
    const string dateFormat = "yyyy-MM-dd";
    if (e.Column.Name.Contains("ValidTo"))
    {
        radDateTimePickerElement.CustomFormat = radMaskedEditBoxElement.Mask = $"{dateFormat} 23:59:59";
    }
    else if (e.Column.Name.Contains("ValidFrom"))
    {
        radDateTimePickerElement.CustomFormat = radMaskedEditBoxElement.Mask = $"{dateFormat} 00:00:00";
    }
    else
    {
        radDateTimePickerElement.CustomFormat = radMaskedEditBoxElement.Mask = $"{dateFormat} HH:mm:ss";
    }
}

 

Thank you!

0
Wojtek Victor
Top achievements
Rank 1
answered on 09 Feb 2017, 08:18 PM

Do I have to implement something similar to this, but catching the TAB and ENTER keys instead?

0
Dimitar
Telerik team
answered on 10 Feb 2017, 11:28 AM
Hello Victor,

I was able to reproduce this. It is caused by an issue in our implementation, I have logged the issue in our Feedback Portal. I have added a vote for it on your behalf as well. You can track its progress, subscribe for status changes and add your comment to it here. I have also updated your Telerik Points.

To workaround this you need to create custom editor:
class Myditor : RadDateTimeEditor
{
    public override bool IsModified
    {
        get
        {
            return true;
  
        }
    }
}

You can use the EditorRequired event to replace the default editor:
private void RadGridView1_EditorRequired(object sender, EditorRequiredEventArgs e)
{
    if (e.EditorType == typeof(RadDateTimeEditor))
    {
        e.Editor = new Myditor();
    }
}

Should you have any other questions do not hesitate to ask.

Regards,
Dimitar
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
GridView
Asked by
Louis
Top achievements
Rank 1
Answers by
Peter
Telerik team
Lovsten
Top achievements
Rank 1
Jose Monerto
Top achievements
Rank 1
Jack
Telerik team
Wojtek Victor
Top achievements
Rank 1
Dimitar
Telerik team
Share this question
or