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

Rad Date picker problem to find control

5 Answers 190 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
vinoth sansar
Top achievements
Rank 2
vinoth sansar asked on 03 Jan 2011, 12:31 PM
Dear Telerik,

     Am using RadTimePicker,RadDateTimePicker and RadDatePicker. I cant find the control in dynamically. I need DisplayDateFormat from database side. If i find the control is RadTimePicker, that ll execute on all loops like that control is RadTimePicker and RadDateTimePicker and RadDatePicker. so i cant set DisplayDateFormat properly. pls solve this problem.

                     if (Ctrl is RadDatePicker)
                {
                    ((RadDatePicker)Ctrl).DateInput.DisplayDateFormat = "dd/MM/yyyy";
                }
                if (Ctrl is RadTimePicker)
                {
                    ((RadTimePicker)Ctrl).DateInput.DisplayDateFormat = "hh:mm tt";
                }
                if (Ctrl is RadDateTimePicker)
                {
                    ((RadDateTimePicker)Ctrl).DateInput.DisplayDateFormat="dd/MM/yyyy hh:mm tt "
                }

5 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 03 Jan 2011, 01:17 PM
Hello Vinoth,

I am not sure about ur scenario. If the controls are nested inside any other control, you need to access the main control first and then get refrence to inner control using FindControl() method and set the DisplayDateFomat. Otherwise if the control is on page, then you could simply use the ID to access the control and set the DateFormat.

Thanks,
Princy.
0
Daniel
Telerik team
answered on 03 Jan 2011, 01:38 PM
Hello Vinoth,

Please examine the attached sample project. I hope this helps.

Regards,
Daniel
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
vinoth sansar
Top achievements
Rank 2
answered on 03 Jan 2011, 02:09 PM
Dear Daniel,
  Thanks for your project. Its working partial only. RadTimePicker is showing include date.But i need only time. The Problem is because, When we check "if (ctrl is RadTimePicker)" this will satisfying both  "RadDateTimePicker" and "RadTimePicker". When i tracing your project code, the "RadDatePicker" loop only work correctly. can u understand my problem.
pls sort out. i need urgently
0
Accepted
Daniel
Telerik team
answered on 03 Jan 2011, 02:40 PM
Hello Vinoth,

Try the following modification:
if(ctrl.GetType().Name == "RadDatePicker")
...
else if(ctrl.GetType().Name == "RadTimePicker")
...

Let me know if the problem still persists.

Regards,
Daniel
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
vinoth sansar
Top achievements
Rank 2
answered on 04 Jan 2011, 06:10 AM
 Thanks Daniel... Now its working fine.
  
Tags
Calendar
Asked by
vinoth sansar
Top achievements
Rank 2
Answers by
Princy
Top achievements
Rank 2
Daniel
Telerik team
vinoth sansar
Top achievements
Rank 2
Share this question
or