SelectedDatePicker tooltip value

7 posts, 1 answers
  1. Lukrs
    Lukrs avatar
    39 posts
    Member since:
    Sep 2012

    Posted 15 Oct 2008 Link to this post

    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";
        }
  2. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 16 Oct 2008 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Lukrs
    Lukrs avatar
    39 posts
    Member since:
    Sep 2012

    Posted 17 Oct 2008 Link to this post

    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
  5. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 17 Oct 2008 Link to this post

    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.
  6. Lukrs
    Lukrs avatar
    39 posts
    Member since:
    Sep 2012

    Posted 18 Oct 2008 Link to this post

    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
  7. Answer
    Peter
    Admin
    Peter avatar
    6637 posts

    Posted 20 Oct 2008 Link to this post

    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.
  8. Lukrs
    Lukrs avatar
    39 posts
    Member since:
    Sep 2012

    Posted 21 Oct 2008 Link to this post

    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
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017