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

GridDateTimeColumn Edit Mode Problem

8 Answers 272 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Syed M Ali Shah
Top achievements
Rank 1
Syed M Ali Shah asked on 04 Sep 2009, 02:39 AM
Hi,

I am so stuck in finding out how can i configure the datetimecolumn in edit mode. Situation is I have to enter time in minutes in the edit mode: HH:mm (24hrs time) so user may enter time say 59mins --> 00:59. I am using GridDateTimeColumn. It is displaying the time correctly in the grid because I am using the DataFormatString:
<tel:GridDateTimeColumn Datafield="MyTime" ...UniqueName="MyTime"  ... DataFormatString="{0:HH:mm}"... PickerType="TimeOnly" />
But when I edit any row in the grid the MyTime column displays the time : 12:59 AM which is quite confusing.

If I use a RadTimePicker outside the grid the I can setup the dateinput view as:
<tel:RadTimePicker ... >
  <DateInput runat="server" DateFormat="HH:mm" DisplayDateFormat="HH:mm" />
</tel:RadTimePicker>

I also tried to setup the properties of datatime control in ItemDataBound but it is not applying. Is there any thing like DateInput.... in GridDateTimeColumn, so that we can set the options (DateInput,No popup button etc) in Edit / insert mode.

Any help will be so much appreciated.

Cheers, Ali

8 Answers, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 08 Sep 2009, 07:53 AM
Hi Syed,

One possible option in this case would be to get a reference to the datetimepicker, when the control enters edit mode, and set the relevant values. Alternatively, you can use a template column, and nest a datetimepicker in it, which will have the related settings defined statically.
I hope this information helps.

Best wishes,
Yavor
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
Syed M Ali Shah
Top achievements
Rank 1
answered on 08 Sep 2009, 09:43 AM
Hi,

Thanks for your reply. I have tried setting up a template column with datetimepicker in it. But it shows the textbox to input date in the grid. Could you please give me a small example on how can i get reference to datetimepickercolumn and set its date-input format?

Cheers
Syed

0
Princy
Top achievements
Rank 2
answered on 08 Sep 2009, 10:40 AM
Hello Syed,

You can access the DatePicker control in the GridDateTimeColumn when the grid is in edit mode and set its format as shown below:
c#:
protected void RadGrid_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) 
    { 
        if (e.Item is GridEditableItem && e.Item.IsInEditMode) 
        { 
            GridEditableItem dataItem = (GridEditableItem)e.Item; 
            RadDatePicker picker = (RadDatePicker)dataItem["DateTimeColumnUniqueName"].Controls[0]; 
            picker.DateInput.DateFormat = "HH:mm"
            picker.DateInput.DisplayDateFormat = "HH:mm";           
        } 
    } 

Thanks
Princy.
0
Syed M Ali Shah
Top achievements
Rank 1
answered on 08 Sep 2009, 11:01 AM
Hi,

Thanks again for sending some code. I applied it but still it doesnt affect the date input in edit mode. I am using GridDateTimeColumn. so after applying HH:mm. It shows me 12:59 AM instead of showing 00:59. Can you please check it whether it is happening with me or is it the actual problem? Thanks

cheers,
S
0
Sanyukta
Top achievements
Rank 1
answered on 28 May 2014, 09:18 AM
Dear Sir/Madam,
I am having a problem with the GridDateTimeColumn in the Radgrid.
It is working properly on my local server. But when uploaded on the actual server, it is behaving inconsistently.
The problem is in the edit mode.
When the date is valid in both dd/mm/yyyy and mm/dd/yyyy, it is working. For eg. 12/12/2013 is working but 13/12/2013 or 12/13/2013 does not work.
The column where the dates are according to above, the edit mode opens. But for the other dates, it does not open only, nor does it give any error.



0
Angel Petrov
Telerik team
answered on 02 Jun 2014, 07:01 AM
Hi Sanyukta,

I have to say that the behavior experienced is not expected. Could you please ensure that a JavaScript error is not present on the page?

Note that I tried reproducing the described problem in an isolated sample but to no avail. Please examine the attached test website and tell us what differs in your case. If you can modify it in such a manner so that the issue can be observed we should be able to find its root cause.

Regards,
Angel Petrov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Sanyukta
Top achievements
Rank 1
answered on 02 Jun 2014, 09:26 AM
Hi Angel,

Actually I had more than 1 GridDateTimeColumns in my grid. One of them was a ReadOnly="true".

Removing that ReadOnly="true", solved the issue for the time being.

I hope this helps in solving the issue.
0
Angel Petrov
Telerik team
answered on 05 Jun 2014, 08:00 AM
Hi Sanyukta,

Setting one GridDateTimeColumn as ReadOnly should not prevent the row from being opened for edit. I have modified the previously provided example in order to replicate the problem but was unable to do so. Could you please examine the sample implementation and tell us what differs in your case?

Please note that without replicating the problem locally we may not be able to provide a precise answer on why does it occur. That said I would like to ask you to modify the attached website or provide us with the entire contents of the problematic page so we could further research the matter.

Regards,
Angel Petrov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Syed M Ali Shah
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Syed M Ali Shah
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Sanyukta
Top achievements
Rank 1
Angel Petrov
Telerik team
Share this question
or