This is a migrated thread and some comments may be shown as answers.
Calender display ToolTip
3 Answers 32 Views
This is a migrated thread and some comments may be shown as answers.
Harah Day
Top achievements
Rank 1
Harah Day asked on 14 Nov 2009, 10:40 PM
I'm trying to get Tooltip displayed based on given day. I followed the Calendar demo example but its not working. Here are my codes.

ASPX Code:
            <telerik:RadCalendar ID="RadCalendar1" OnDayRender="RadCalendar1_DayRender" Width="200" Height="200" Skin="Web20" runat="server" />
            <telerik:RadToolTipManager Width="215px" Height="300px" RelativeTo="Element" ID="RadToolTipManager1"
             runat="server" OffsetX="15" OnAjaxUpdate="RadToolTipmanager1_AjaxUpdate" Position="MiddleRight" Skin="Telerik">
            </telerik:RadToolTipManager>

VB Code:
Protected Sub RadCalendar1_DayRender(ByVal sender As Object, ByVal e As Telerik.Web.UI.Calendar.DayRenderEventArgs)
        Dim ID As Integer = IsDayRegisteredForTooltip(e.Day.[Date])
        If ID <> -1 Then
            Dim cell As TableCell = e.Cell
            cell.CssClass = "Appointment"
            cell.Attributes.Add("ID", "Calendar1_" + ID.ToString())
            RadToolTipManager1.TargetControls.Add(e.Cell.Attributes("ID"), ID.ToString().Substring(ID.ToString().IndexOf("_"c) + 1), True)
        End If
    End Sub
    Private Function IsDayRegisteredForTooltip(ByVal p_Eventdate As DateTime) As Integer
        Dim m_dResult As DataSet
        Dim clsSBAMethod As New SBAMethods
        Dim m_startDate, m_endDate As Date

        m_startDate = p_Eventdate
        m_endDate = p_Eventdate

        m_dResult = GetEventList(m_startDate.ToString("MM/dd/yyyy"), m_endDate.ToString("MM/dd/yyyy"), "", "", 0, 0)
        If m_dResult.Tables(0).Rows.Count > 0 Then
            Return Integer.Parse(m_dResult.Tables(0).Rows(0)("cale_id"))
        End If
        Return -1
    End Function

    Protected Sub RadToolTipManager1_AjaxUpdate(ByVal sender As Object, ByVal e As Telerik.Web.UI.ToolTipUpdateEventArgs)

        Dim details As c_eventdetail = DirectCast(Me.LoadControl("../user_controls/c_eventdetail.ascx"), c_eventdetail)
        details.EventID = Integer.Parse(e.Value)
        e.UpdatePanel.ContentTemplateContainer.Controls.Add(details)
    End Sub

EventDetail Control code:
 Private Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender
        Dim clsSBAMethod As New SBAMethods
        Dim m_Result As DataSet
        m_Result = GetEventDetails(EventID)
        If m_Result.Tables(0).Rows.Count > 0 Then
            lblDetail.Text = m_Result.Tables(0).Rows(0)("descript")
        End If
    End Sub


Can someone please help me, all the data are coming from webservice method?


3 Answers, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 19 Nov 2009, 08:04 AM
Hello Ranga,

Could you please check the attached sample and let me know if it works as desired or I missed something from your logic out?

Greetings,
Iana
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
Harah Day
Top achievements
Rank 1
answered on 19 Nov 2009, 10:14 PM
Thanks Iana for your response. Based on provided code it works but I'm trying to load using MasterPage and i have few custom build controls. I even tried loading simple text on tooltip it didn't work. Please check the full code. Thanks for your help. 

ev_listing_telerik.aspx:

<%@ Page Language="vb" AutoEventWireup="false" MasterPageFile="~/Master/MasterPage.Master" CodeBehind="ev_listing_telerik.aspx.vb"
    Inherits="ev_listing_Telerik" %>

<%@ Register TagPrefix="uc1" TagName="c_exception" Src="../user_controls/c_exception.ascx" %>
<%@ Register TagPrefix="uc1" TagName="c_dropdown" Src="../user_controls/c_dropdown.ascx" %>
<%@ Register TagPrefix="uc1" TagName="c_textbox" Src="../user_controls/c_textbox.ascx" %>
<%@ Register TagPrefix="uc1" TagName="c_label" Src="../user_controls/c_label.ascx" %>

<asp:content id="Content1" contentplaceholderid="head" runat="server">

<style type="text/css">
    .tableClass,
    .tableClass td
    {
      border-collapse: collapse;
      border: solid 1px #ccc;
      vertical-align: top;
      padding: 20px;
    }
   
    .tableClass strong
    {
        display: inline-block;
        padding: 4px;
        font-size: 11px;
    }
   
   
    .Appointment
    {
        _ackground:#DFEEFF none repeat scroll 0 0;
       
        background:#DFEEFF url(../images/icon_calendar.gif) center no-repeat;
        border-color:#F6FAFF -moz-use-text-color #A7C0DF;
        border-style:solid none;
        border-width:1px 0;
    }
    </style>
    </asp:content>

<asp:content id="Content2" contentplaceholderid="ExceptionList" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <uc1:c_exception id="excException" runat="server"></uc1:c_exception>
</asp:content>

<asp:content id="Content3" contentplaceholderid="TitlePage" runat="server">
    Event Listing
</asp:content>

<asp:content id="Content4" contentplaceholderid="ContentPage" runat="server">
    <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
        <ProgressTemplate>
            <uc2:c_ajax_loading ID="c_ajax_loading1" runat="server" />
        </ProgressTemplate>
    </asp:UpdateProgress>
    <asp:UpdatePanel ID="UpdatePanel2" runat="server">
        <ContentTemplate>
            <table cellspacing="0" cellpadding="3" border="0" width="80%">
                <tr>
                    <td class="TextMediumNormal" align="left">
                        <uc1:c_label ID="lblEventList" runat="server" MsgCode="lblEventLstMsg" CSSClass="TextMediumNormal" />
                    </td>
                </tr>
            </table>
        </ContentTemplate>
    </asp:UpdatePanel>

    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>  
<table width="85%" border="0" cellpadding="3" cellspacing="3">
<tr><td width="25%" valign="top">
   
<table cellspacing="2" cellpadding="2" width="25%" border="0" class="TableLightBorder">   
            <tr>
                <td class="SCSubTitle">
                    Events Calendar
                </td>
            </tr>
            <tr>
            <td>
            <telerik:RadToolTipManager Width="215px" Height="300px" RelativeTo="Element" ID="RadToolTipManager1"
             runat="server" OffsetX="15" OnAjaxUpdate="RadToolTipmanager1_AjaxUpdate" Position="MiddleRight" Skin="Telerik">
            </telerik:RadToolTipManager>
            </td></tr>
</table>

</td>

</tr>

      
</table>   
    </ContentTemplate>
    </asp:UpdatePanel>
    

</asp:content>


ev_listing_telerik.aspx.vb:

Imports System.Data

Imports Telerik.Web.UI
Partial Public Class ev_listing_Telerik
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub RadCalendar1_DayRender(ByVal sender As Object, ByVal e As Telerik.Web.UI.Calendar.DayRenderEventArgs)
        Dim ID As Integer = IsDayRegisteredForTooltip(e.Day.[Date])
        If ID <> -1 Then
            Dim cell As TableCell = e.Cell
            cell.CssClass = "Appointment"
            cell.Attributes.Add("ID", "Calendar1_" + ID.ToString())
            RadToolTipManager1.TargetControls.Add(e.Cell.Attributes("ID"), ID.ToString().Substring(ID.ToString().IndexOf("_"c) + 1), True)
        End If
    End Sub
    Private Function IsDayRegisteredForTooltip(ByVal p_Eventdate As DateTime) As Integer
        Dim m_dResult As DataSet
        Dim clsSBAMethod As New SBAMethods
        Dim m_startDate, m_endDate As Date

        m_startDate = p_Eventdate
        m_endDate = p_Eventdate

        m_dResult = clsSBAMethod.GetEventList(m_startDate.ToString("MM/dd/yyyy"), m_endDate.ToString("MM/dd/yyyy"), "", "", 0, 0)
        If m_dResult.Tables(0).Rows.Count > 0 Then
            Return Integer.Parse(m_dResult.Tables(0).Rows(0)("cale_id"))
        End If
        Return -1
    End Function

    Protected Sub RadToolTipManager1_AjaxUpdate(ByVal sender As Object, ByVal e As Telerik.Web.UI.ToolTipUpdateEventArgs)
        Dim details As c_eventdetail = DirectCast(Me.LoadControl("../user_controls/c_eventdetail.ascx"), c_eventdetail)
        details.EventID = Integer.Parse(e.Value)
        e.UpdatePanel.ContentTemplateContainer.Controls.Add(details)
    End Sub
End Class

c_eventdetail.ascx:
<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="c_eventdetail.ascx.vb" Inherits="JaxChamberPro.c_eventdetail" %>
<table runat="server" id="ProductWrapper" class="inner" border="0" cellpadding="2"
    cellspacing="0">
   <tr>
        <td style="width: 200px; text-align: center;">
        Detail: <asp:Label ID="lblDetail" runat="server"></asp:Label><br />
        </td>
   </tr>
</table>

c_eventdetail.ascx.vb:

Partial Public Class c_eventdetail
    Inherits System.Web.UI.UserControl
    Private m_EventId As Integer

    Public Property EventID() As String
        Get
            Return m_EventId

        End Get
        Set(ByVal Value As String)
            m_EventId = Value
        End Set
    End Property

    Private Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender
        Dim clsSBAMethod As New SBAMethods
        Dim m_Result As DataSet
        m_Result = clsSBAMethod.GetEventDetails(EventID)
        If m_Result.Tables(0).Rows.Count > 0 Then
            lblDetail.Text = m_Result.Tables(0).Rows(0)("descript")
        End If
    End Sub
End Class

0
Iana Tsolova
Telerik team
answered on 20 Nov 2009, 09:11 AM
Hello Ranga,

Could you please elaborate what happened when you tried loading simple text into the tooltip? Is the code in the AjaxUpdate event handler executed? Additionally, please try placing the RadToolTipManager outside the UpdatePanel or set the panel UpdateMode property to Conditional.

Let me know how it goes.

Greetings,
Iana
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.
Asked by
Harah Day
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Harah Day
Top achievements
Rank 1
Share this question
or