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

hyperlink the subject

18 Answers 189 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Nyceane
Top achievements
Rank 1
Nyceane asked on 09 Dec 2007, 11:52 PM
is there anyway to hyperlink the subject or collection?
I thought about using tooptip as a way to hyperlink things, but so far its not very successful.  are there any ways either I can hyperlink the subject itself or through tooltip?

Thank you

18 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 10 Dec 2007, 12:36 PM
Hi Peter,

You can do either way: Using RadToolTip or Hyperlink in Appointment Template as shown in these examples. Let us know if you have any other questions.


Cheers,
Peter
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Nyceane
Top achievements
Rank 1
answered on 10 Dec 2007, 04:22 PM
Peter,
neither example shows how to hyperlink the subject to another webpage.
0
Peter
Telerik team
answered on 10 Dec 2007, 05:00 PM

Hello Peter,

I might have misunderstood what you want to achieve. I thought you need a tooltip to display the entire content of an appointment.

As for the other method, I am sorry for not being more specific. Here is an example you can try:

<AppointmentTemplate> 
<href='<%# Eval("URL") %>' >               
    <%# Eval("Subject") %> 
</a> 
</AppointmentTemplate> 

You can use Custom Attributes to store the url of the appointments.


Cheers,

Peter
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Nyceane
Top achievements
Rank 1
answered on 10 Dec 2007, 06:42 PM
Peter, 
I found another way of solving this using tooltip, which makes the entire template a little more pretty =)  So I pretty much made a acsx detail page based on tooltip load on demand example.

my question for you is, now that I have both schedule and calender on the same page, how do I disable the tooltip on the calender.
0
Peter
Telerik team
answered on 11 Dec 2007, 10:58 AM
Hello Peter,

Here is a couple of things to consider:
  1. Please note that you have to add the ClientIDs of the Appointments to the TargetControls collection of the manager - that is exactly what the second argument of the Add method indicates:
            If (e.Appointment.Visible AndAlso Not IsAppointmentRegisteredForTooltip(e.Appointment)) Then 
                RadToolTipManager1.TargetControls.Add(e.Appointment.ClientIDTrue)  
            End If 
  2. Please note that you have to update the RadToolTipManager when you add IDs to its TargetControls collection. Otherwise, the manager will not be updated and its TargetControls collection will be empty - resulting in tooltipifying all elements on the page with Target attribute. As you use the AppointmentDataBound handler to do this, you have to update the manager whenever the RadScheduler is databound. However, the current version of the RadToolTipManager does not work good, when the manager is updated with RadAjaxManager. That is why I would recommend that for this particular case, you use an UpdatePanel, as in the online example in order to get the desired result.


All the best,
Peter
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Nyceane
Top achievements
Rank 1
answered on 11 Dec 2007, 01:39 PM
peter, under the example page itself

http://www.telerik.com/DEMOS/ASPNET/Prometheus/Scheduler/Examples/RadToolTip/DefaultCS.aspx

its missing the c# code behind it, would you please provide me the c# version of that code? the only thing it comes with is the c# for ascx page.

Also, AppointmentToolTip under function

 Dim toolTip As AppointmentToolTip = CType(LoadControl("AppointmentToolTip.ascx"), AppointmentToolTip)

is not valid, I can not declare toolTip as a variable.  would you please look into that     
0
Peter
Telerik team
answered on 11 Dec 2007, 01:50 PM
Hi Peter,

The code-behind tabs in the online examples can display source for just one file. Here is the C# code for the aspx page:
using System;  
using System.Collections;  
using System.Collections.Generic;  
using System.Data.OleDb;  
using System.ComponentModel;  
using System.Data;  
using System.Drawing;  
using System.Web;  
using System.Web.SessionState;  
using System.Web.UI;  
using System.Web.UI.WebControls;  
using System.Web.UI.HtmlControls;  
using Telerik.QuickStart;  
using Telerik.Web.UI;  
 
namespace Telerik.Web.Examples.Scheduler.RadToolTip  
{  
    public partial class DefaultCS : XhtmlPage  
    {  
        private void Page_Load(object sender, System.EventArgs e)  
        {  
            RadScheduler1.AppointmentCreated += new AppointmentCreatedEventHandler(RadScheduler1_AppointmentCreated);  
            RadScheduler1.DataBound += new EventHandler(RadScheduler1_DataBound);  
        }  
 
        protected void RadScheduler1_AppointmentCreated(object sender, AppointmentCreatedEventArgs e)  
        {  
            if (e.Appointment.Visible && !IsAppointmentRegisteredForTooltip(e.Appointment))  
            {  
                RadToolTipManager1.TargetControls.Add(e.Appointment.ClientID, true);  
            }  
        }  
 
        private bool IsAppointmentRegisteredForTooltip(Appointment apt)  
        {  
            foreach (ToolTipTargetControl targetControl in RadToolTipManager1.TargetControls)  
            {  
                if (targetControl.TargetControlID == apt.ClientID)  
                {  
                    return true;  
                }  
            }  
 
            return false;  
        }  
 
        protected void RadScheduler1_DataBound(object sender, EventArgs e)  
        {  
            RadToolTipManager1.TargetControls.Clear();  
            ScriptManager.RegisterStartupScript(thistypeof(XhtmlPage), "HideToolTip""hideActiveToolTip();"true);  
        }  
 
        protected void RadToolTipManager1_AjaxUpdate(object sender, ToolTipUpdateEventArgs e)  
        {  
            int aptId = int.Parse(e.TargetControlID.Split('_')[1]);  
            Appointment apt = RadScheduler1.Appointments[aptId];  
 
            AppointmentToolTip toolTip = (AppointmentToolTip) LoadControl("AppointmentToolTip.ascx");  
            toolTip.TargetAppointment = apt;  
            e.UpdatePanel.ContentTemplateContainer.Controls.Add(toolTip);  
        }  
    }  
}  
 


All the best,
Peter
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Nyceane
Top achievements
Rank 1
answered on 11 Dec 2007, 02:06 PM
Peter
0
Nyceane
Top achievements
Rank 1
answered on 11 Dec 2007, 03:04 PM
Peter, 

I have duplicated the exact same code, and yet almost everything I made gives me an error.

for every appointment that my mouse pass through it displays 

"Input String was not in a correct format"

Do you know anything about this error?

The line thats giving error is 
int aptId = int.Parse(e.TargetControlID.Split('_')[1]);

I really dont know how to fix this line.  Would you please take a look at it?
Thanks

Peter
0
Peter
Telerik team
answered on 12 Dec 2007, 03:13 PM
Hi Peter,

Here is an updated version of the code:
using System;  
using System.Collections;  
using System.Collections.Generic;  
using System.Data.OleDb;  
using System.ComponentModel;  
using System.Data;  
using System.Drawing;  
using System.Web;  
using System.Web.SessionState;  
using System.Web.UI;  
using System.Web.UI.WebControls;  
using System.Web.UI.HtmlControls;  
using Telerik.QuickStart;  
using Telerik.Web.UI;  
 
namespace Telerik.Web.Examples.Scheduler.RadToolTip  
{  
    public partial class DefaultCS : XhtmlPage  
    {  
        private void Page_Load(object sender, System.EventArgs e)  
        {  
            RadScheduler1.AppointmentCreated += new AppointmentCreatedEventHandler(RadScheduler1_AppointmentCreated);  
            RadScheduler1.DataBound += new EventHandler(RadScheduler1_DataBound);  
        }  
 
        protected void RadScheduler1_AppointmentCreated(object sender, AppointmentCreatedEventArgs e)  
        {  
            if (e.Appointment.Visible && !IsAppointmentRegisteredForTooltip(e.Appointment))  
            {  
                RadToolTipManager1.TargetControls.Add(e.Appointment.ClientID, true);  
            }  
        }  
 
        private bool IsAppointmentRegisteredForTooltip(Appointment apt)  
        {  
            foreach (ToolTipTargetControl targetControl in RadToolTipManager1.TargetControls)  
            {  
                if (targetControl.TargetControlID == apt.ClientID)  
                {  
                    return true;  
                }  
            }  
 
            return false;  
        }  
 
        protected void RadScheduler1_DataBound(object sender, EventArgs e)  
        {  
            RadToolTipManager1.TargetControls.Clear();  
            ScriptManager.RegisterStartupScript(thistypeof(XhtmlPage), "HideToolTip""hideActiveToolTip();"true);  
        }  
 
        protected void RadToolTipManager1_AjaxUpdate(object sender, ToolTipUpdateEventArgs e)  
        {  
            Appointment apt = RadScheduler1.Appointments[aptId];  
 
            AppointmentToolTip toolTip = (AppointmentToolTip) LoadControl("AppointmentToolTip.ascx");  
            toolTip.TargetAppointment = apt;  
            e.UpdatePanel.ContentTemplateContainer.Controls.Add(toolTip);  
        }  
    }  
}  
 

You can also use the Live Examples which we provide with the local installation of the Telerik.Web.UI suite or the zip file.


Kind regards,
Peter
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Nyceane
Top achievements
Rank 1
answered on 12 Dec 2007, 10:43 PM
Peter, 
all you did was remove the line

int aptId = int.Parse(e.TargetControlID.Split('_')[1]);

but the fact is that aptId is still required and tooltop would not allow strings, without aptId the file would not compile

CS0103: The name 'aptId' does not exist in the current context

and with that line "Input String was not in a correct format" keeps popping up.  Would you please take a look at it?

Thank you
Best Regards
Peter
0
Nyceane
Top achievements
Rank 1
answered on 13 Dec 2007, 12:45 AM
Peter, 
I've made a new scheduler page and using exact same code as you provided, here is the problem.

On my original project, this line
int aptId = int.Parse(e.TargetControlID.Split('_')[1]);
would constantly bring up "ContentPlaceHolder1" as value rather than than the value thats assigned to the appointment such as '1' or '2', therefore the line itself cannot convert "ContentPlaceHolder1" into integer.

this is the debug watch with master page
e.TargetControlID.Split('_')[1] "ContentPlaceHolder1" string

This is the debug watch without master page
e.TargetControlID.Split('_')[1] "12" string

this would happen on any website with master page, so the code you guys wrote behind does not apply to anything with master page, do you know how to fix it? are there any other way to access the schedule other than using e? 

Thank you
Best Regards
Peter
0
Nyceane
Top achievements
Rank 1
answered on 13 Dec 2007, 01:04 AM
Peter,
Nevermind, I needed to convert e.TargetControlID.SPlit(_)[3] instead of [1] in this case.

[2] is RadScheduler1

so thats fixed, thanks for the help tho =)

do you know how to shut down the calender part of radtooltip?
0
Peter
Telerik team
answered on 13 Dec 2007, 09:14 AM
Hello Nyceane,

I am glad you managed to find the problem yourself. As for the other question, edit the 
AppointmentToolTip.ascx file from the Using RadTooltip example as follows:

<div style="margin:5px 5px 0px 5px;">  
    <%--<div style="border-bottom:solid 1px #ccc;margin-bottom:9px;font-size:11px;">Starting on: <asp:Label runat="server" ID="StartingOn"></asp:Label></div>  
    --%><asp:TextBox runat="server" ID="FullText" TextMode="MultiLine" Width="100%" Rows="7" style="border:0;font-size:12px;background:transparent;"></asp:TextBox> 
</div> 

protected override void  OnPreRender(EventArgs e)  
        {  
            base.OnPreRender(e);  
 
            //StartingOn.Text = apt.Owner.UtcToDisplay(apt.Start).ToString();  
            FullText.Text = apt.Subject;  
        } 

Please, feel free to correct me if I have misunderstood what you want to achieve.


Best wishes,
Peter
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Nyceane
Top achievements
Rank 1
answered on 13 Dec 2007, 05:44 PM
Peter,
I have both RadCalender and RadScheduler on one page,  now that I have the scheduler running with the tooltip under my command, the RadCalender trying to use RadToolTipManager as well, but it can not load anything so therefore it generates error.

I want RadToolTipManager to be only used for RadScheduler and no other telerik application on the page, how do I achieve that?

Thank  you
Peter
0
Peter
Telerik team
answered on 14 Dec 2007, 04:26 PM

I thought you managed to resolve this problem using the post dated: 12/11/2007 4:58:10 AM. Did you try this suggestion and if yes what problems did you experience?


Regards,
Peter
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Nyceane
Top achievements
Rank 1
answered on 14 Dec 2007, 09:13 PM
Peter, I am using UpdatePanel, yet ToolTipManager would still try to pick up stuff from RadCalender and creates error for me.
0
Peter
Telerik team
answered on 15 Dec 2007, 01:38 PM
Hello Nyceane,

It would be best if we can have a look at your code. You can paste it here, but it would be better if you open a support ticket and send us a small working demo project of the issue.



Peter
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Scheduler
Asked by
Nyceane
Top achievements
Rank 1
Answers by
Peter
Telerik team
Nyceane
Top achievements
Rank 1
Share this question
or