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

SelectedDatePicker tooltip value

6 Answers 131 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Lukrs
Top achievements
Rank 2
Lukrs asked on 15 Oct 2008, 09:06 PM
Hi,

I have encountered a problem, with SelectedDatePicker a child control of RadScheduler. The event I pasted below changes the default tooltip of SelectedDatePicker. Somehow AJAX requests change the tooltip value back to default. If I do a page refresh, the value is set as it should be again.

I would really appreciate your help,
thanks in advance, LP, Luka


 protected void RadScheduler1_Load(object sender, EventArgs e)
    {
        RadDatePicker dateP = this.RadScheduler1.FindControl("SelectedDatePicker") as RadDatePicker;
        dateP.ToolTip = "Izberite datum";
    }

6 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 16 Oct 2008, 12:40 PM
Hello Luka,

You need to set the ToolTip to the DatePopupButton of RadDatePicker. Also, you should use PreRenderComplete event, since RadScheduler's event happens too early.

 protected void Page_PreRenderComplete(object sender, EventArgs e)  
    {  
        RadDatePicker dateP = this.RadScheduler1.FindControl("SelectedDatePicker"as RadDatePicker;  
        dateP.DatePopupButton.ToolTip = "Izberite datum";  
    } 


Regards,
Peter
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Lukrs
Top achievements
Rank 2
answered on 17 Oct 2008, 02:54 PM
Hi,

I tried that, but when I try to open the advanced edit form an error occurs in the
Page_PreRenderComplete.

It says:


Object reference not set to an instance of an object.

and the advanced edit or insert form isn't opened because of that error.

Regards,
Luka
0
Peter
Telerik team
answered on 17 Oct 2008, 03:17 PM
Hello Luka,

This is strange - we did not experience such an error on our side. Can you send us a demo project via a support ticket?

Kind regards,
Peter
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Lukrs
Top achievements
Rank 2
answered on 18 Oct 2008, 03:59 PM
Hi,

It is strange, that you didn't experience souch a problem on your side.

I have worked on the problem, and found out the reason for the exception is probably that the SelectedDatePicker is never needed or shown in advanced edit/insert form. Therefore the object is never created.

That is no longer a problem....I used a try-catch block to solve this.

But the advanced edit/insert form has three more date pickers (StartDate, EndDate and the datepicker for the end of range).

How do I reference these datepickers? The Table of Contents only shows how to access SelectedDatePicker.

Regards,
LP, Luka
0
Accepted
Peter
Telerik team
answered on 20 Oct 2008, 08:48 AM
Hello Luka,

Please, try the following code:
protected void RadScheduler1_FormCreated(object sender, SchedulerFormCreatedEventArgs e)     
    {     
        if ((RadScheduler1.SelectedView == SchedulerViewType.MonthView) & (e.Container.Mode == SchedulerFormMode.AdvancedInsert))     
        {     
            RadDateInput endTimeTimeInput = (RadDateInput)e.Container.FindControl("EndTime");     
            RadDatePicker endTimeDatePicker = (RadDatePicker)e.Container.FindControl("EndDate");     
            RadDateInput startTimeTimeInput = (RadDateInput)e.Container.FindControl("StartTime");     
            RadDatePicker startTimeDatePicker = (RadDatePicker)e.Container.FindControl("StartDate");     
         }  

In general, you can use the kb article on How to access controls in the advanced form.


Best wishes,
Peter
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Lukrs
Top achievements
Rank 2
answered on 21 Oct 2008, 12:25 PM
Hello Peter,

I used the following event:

    protected void RadScheduler1_FormCreated(object sender, SchedulerFormCreatedEventArgs e)
    {
        string CalPopupText = "Izberite datum";

        if (e.Container.Mode == SchedulerFormMode.AdvancedInsert || e.Container.Mode == SchedulerFormMode.AdvancedEdit)
        {
           
            RadDatePicker endTimeDatePicker = (RadDatePicker)e.Container.FindControl("EndDate");
            RadDatePicker startTimeDatePicker = (RadDatePicker)e.Container.FindControl("StartDate");
            RadDatePicker RangeEndDatePicker = (RadDatePicker)e.Container.FindControl("RangeEndDate");

            endTimeDatePicker.DatePopupButton.ToolTip = CalPopupText;
            startTimeDatePicker.DatePopupButton.ToolTip = CalPopupText;
            RangeEndDatePicker.DatePopupButton.ToolTip = CalPopupText;
        }
    }


Works like a charm :)

Thank you,
LP, Luka
Tags
Scheduler
Asked by
Lukrs
Top achievements
Rank 2
Answers by
Peter
Telerik team
Lukrs
Top achievements
Rank 2
Share this question
or