Hello,
I have a RadListView control which displays RadToolTip by coming over an image. Unfortunatily, the radtooltip is not displayed (It was before) for unknown reason - I recieve an error message (Please view the attached image).. Please view the web page:
http://tmonavot.com/Pages/GiftGallery.aspx
Here is my code:
<%@ Master Language="C#" MasterPageFile="~/Common/MasterPages/DefaultMasterPage.master" AutoEventWireup="true" CodeFile="DfosMasterPage.master.cs" Inherits="Pages_MasterPages_DfosMasterPage" %>
<%@ Register Src="~/Pages/UserControls/ProductDetails.ascx" TagName="ProductDetails" TagPrefix="uc1" %>
<%@ Register Src="~/Pages/UserControls/ItemsPagesConentWebUserControl.ascx" TagName="ItemsPagesConentWebUserControl" TagPrefix="uc2" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<style type="text/css">
.RadListView .rlvFloated div.rlvA,
.RadListView .rlvFloated div.rlvI
{
float: right;
}
div.RadMenu .rmItem .rmLink .rmLeftImage,
div.RadMenu .rmItem .rmLink,
div.RadMenu .rmLink .rmText
{
margin: 0;
padding: 1px;
}
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:Panel ID="Panel1" style="margin-top:15px;" runat="server" >
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td colspan="2">
<asp:Panel ID="HeaderLabelPanel" runat="server" style="margin-right:5px;">
<asp:Label ID="HeaderLabel" runat="server" SkinID="HeaderText" Text=""></asp:Label>
</asp:Panel>
</td>
</tr>
<tr>
<td valign="top" style="width:210px;">
<br />
<telerik:RadAjaxPanel ID="DfosMenuPanelRadAjaxPanel" runat="server">
<asp:Panel ID="DfosMenuPanel" runat="server" style="margin-right:1px;">
<telerik:RadMenu ID="RadMenu1" runat="server" Flow="Vertical" Skin="" EnableImagePreloading="true" >
</telerik:RadMenu>
</asp:Panel>
</telerik:RadAjaxPanel>
</td>
<td valign="top" style="width:742px;">
<asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
<asp:Panel ID="HeaderMenuPagesPanel" runat="server" style="margin-top:20px; margin-left:10px; margin-right:10px;">
<telerik:RadAjaxPanel ID="RingsRadAjaxPanel" runat="server">
<script type="text/javascript">
function CloseActiveToolTip() {
setTimeout(function () {
var tooltip = Telerik.Web.UI.RadToolTip.getCurrent();
if (tooltip) tooltip.hide();
}, 1000);
}
</script>
<telerik:RadWindowManager ID="RadWindowManager1" runat="server">
<Windows>
<telerik:RadWindow runat="server" Width="420px" Height="420px" VisibleStatusbar="false" style="z-index:10000;"
ID="ExplorerWindow" Modal="true" Behaviors="Default">
</telerik:RadWindow>
</Windows>
</telerik:RadWindowManager>
<telerik:RadToolTipManager runat="server" ID="RadToolTipManager1" Sticky="true" Position="Center"
Width="400px" Animation="FlyIn" HideEvent="LeaveToolTip" GroupPlaceholderID="GroupsEmployeesContainer"
Skin="DisplayItems" EnableEmbeddedSkins="false" OnAjaxUpdate="OnAjaxUpdate"></telerik:RadToolTipManager>
<asp:Panel ID="ItmPanel" Width="100%" style="margin-right:10px;" runat="server">
<uc2:ItemsPagesConentWebUserControl ID="ItemsPagesConentWebUserControl1" runat="server" />
</asp:Panel>
<br />
<asp:Panel ID="RadListView1Panel" style="margin-right:10px;" HorizontalAlign="Center" runat="server">
<telerik:RadListView runat="server" ID="RadListView1" AllowPaging="True" EnableEmbeddedSkins="false" Width="615px"
DataKeyNames="ItemID" DataSourceID="ObjItems" OnPageIndexChanged="RadListView1_PageIndexChanged" onitemdatabound="RadListView1_ItemDataBound">
<ItemTemplate>
<div class="rlvI" style="margin-left:1px; border:0; border-color:transparent; height:225px; width:315px;">
<center>
<asp:Panel ID="ItmPanel" Width="300px" BackImageUrl="~/Common/Img/BackGrounds/g4.gif" style="margin-right:10px;" Height="210px" runat="server">
<asp:Table ID="Table1" Width="300px" HorizontalAlign="Center" BorderColor="Black" BorderWidth="0" runat="server">
<asp:TableRow ID="TableRow2" Height="20px" runat="server">
<asp:TableCell ColumnSpan="2">
</asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="TableRow1" Height="190px" runat="server">
<asp:TableCell VerticalAlign="Top" HorizontalAlign="Right" ID="TableCell1" Width="200px" runat="server">
<div style="margin-right:5px;">
<asp:Label ID="ItemIDLabel" Visible="false" runat="server" Text='<%# Eval("ItemID") %>'></asp:Label>
<asp:Label ID="ItmNameLabel" SkinID="ItemHeaderText" runat="server" Text='<%# Eval("ItmName") %>'></asp:Label><br /><br />
<asp:Label ID="ItmDescLabel" runat="server" Text='<%# Eval("ItmDesc") %>'></asp:Label>
<asp:Label ID="PriceLabel" runat="server" Visible='<%# (Convert.ToBoolean(Eval("ViewPrice"))) ? true : false %>' Text='<%# "<br/><br/>" + Resources.Resource.PagesItemsPriceLabelText.ToString() + ": " %>'></asp:Label>
<asp:Label ID="Label1" runat="server" Visible='<%# (Convert.ToBoolean(Eval("ViewPrice"))) ? true : false %>' Text='<%# Eval("ItemPrice").ToString() + " " + Resources.Resource.PagesItemsNewIsraeliShekelText.ToString() %>' ></asp:Label>
</div>
</asp:TableCell>
<asp:TableCell ID="TableCell5" VerticalAlign="Top" Width="100px" runat="server">
<asp:Image ID="ItmImage" Width='<%# getSrcImgDim(90, Eval("FileUrl").ToString(),"width") %>' Height='<%# getSrcImgDim(90, Eval("FileUrl").ToString(),"height") %>' ImageUrl='<%# (Eval("FileUrl").ToString().Equals(string.Empty)) ? "~/Pages/Design/Imgs/Itms/NoItem.jpg" : (string.Format("~/Pages/Design/WriteOnImage/CreateBImg.aspx?fileUrl={0}&typ=small", Eval("FileUrl").ToString().Replace("~/","").Replace("/","-"))) %>' runat="server" />
<br /><br /><br />
<asp:LinkButton ID="MoreDetailsLinkButton" Font-Underline="false" Visible='<%# (Convert.ToBoolean(Eval("ViewItmBigDesc"))) ? true : false %>' ForeColor="Black" Font-Bold="true" Text="<%$ Resources:Resource, PagesItemsMoreDetailsLinkButtonText %>" OnClick="MoreDetailsLinkButton_Click" runat="server"></asp:LinkButton>
</asp:TableCell>
</asp:TableRow>
</asp:Table>
</asp:Panel>
</center>
</div>
</ItemTemplate>
<EmptyDataTemplate>
<div class="RadListView RadListView_<%# Container.Skin %>">
<div class="rlvEmpty">
<asp:Label ID="NoItemsFoundLabel" runat="server" Text="<%$ Resources:Resource, PagesItemsNoItemsFoundLabelText %>"></asp:Label>
</div>
</div>
</EmptyDataTemplate>
<LayoutTemplate>
<div class="RadListView RadListViewFloated RadListView_<%# Container.Skin %>" style="background-color:transparent;">
<div class="rlvFloated rlvAutoScroll">
<div id="itemPlaceholder" runat="server">
</div>
</div>
<table cellpadding="0" cellspacing="0" width="100%" style="clear: both;">
<tr>
<td align="center">
<telerik:RadDataPager ID="RadDataPager2" runat="server" Width="280px" PagedControlID="RadListView1"
PageSize="30" >
<Fields >
<telerik:RadDataPagerButtonField FieldType="FirstPrev" />
<telerik:RadDataPagerGoToPageField CurrentPageText="Page: " TotalPageText="of" SubmitButtonText="Go"
TextBoxWidth="15" />
<telerik:RadDataPagerButtonField FieldType="NextLast" />
</Fields>
</telerik:RadDataPager>
</td>
</tr>
</table>
</div>
</LayoutTemplate>
</telerik:RadListView>
</asp:Panel>
<asp:Label ID="MainCtgryLabel" Visible="false" runat="server" ></asp:Label>
<asp:Label ID="SubCtgryLabel" Visible="false" runat="server" ></asp:Label>
<asp:ObjectDataSource ID="ObjItems" runat="server"
SelectMethod="GetItms" TypeName="CtgrsDataLstObjctGetData">
<SelectParameters>
<asp:ControlParameter ControlID="MainCtgryLabel" PropertyName="Text" Name="mainCtgry" Type="String" />
<asp:ControlParameter ControlID="SubCtgryLabel" PropertyName="Text" Name="subCtgry" Type="String" />
</SelectParameters>
</asp:ObjectDataSource>
</telerik:RadAjaxPanel>
</asp:Panel>
</td>
</tr>
</table>
</asp:Panel>
</asp:Content>
and:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
public partial class Pages_MasterPages_DfosMasterPage : System.Web.UI.MasterPage
{
#region Public Properties
private string _headerLabelString;
public string HeaderLabelString
{
get { return _headerLabelString; }
set { _headerLabelString = value; }
}
private string _mainCtgryLabelString;
public string MainCtgryLabelString
{
get { return _mainCtgryLabelString; }
set { _mainCtgryLabelString = value; }
}
private string _subCtgryLabelString;
public string SubCtgryLabelString
{
get { return _subCtgryLabelString; }
set { _subCtgryLabelString = value; }
}
#endregion Public Properties
#region Page Events
#endregion Page Events
#region Virtual Methods
#endregion Virtual Methods
private string browserName = string.Empty;
private string browserVersion = string.Empty;
private string theBrowser = string.Empty;
protected void Page_Load(object sender, EventArgs e)
{
HeaderLabel.Text = HeaderLabelString;
HeaderLabel.Text = HeaderLabelString;
MainCtgryLabel.Text = MainCtgryLabelString;
SubCtgryLabel.Text = SubCtgryLabelString;
browserName = Request.Browser.Browser.ToString();
browserVersion = Request.Browser.Version.ToString();
theBrowser = browserName + " " + browserVersion;
if (!Page.IsPostBack)
{
RadMenu1.LoadContentFile("~/Common/xml/DfosMenu.xml");
}
}
protected void OnAjaxUpdate(object sender, ToolTipUpdateEventArgs args)
{
this.UpdateToolTip(args.Value, args.UpdatePanel);
}
private void UpdateToolTip(string elementID, UpdatePanel panel)
{
Control ctrl = Page.LoadControl("~/Pages/UserControls/ProductDetails.ascx");
panel.ContentTemplateContainer.Controls.Add(ctrl);
ProductDetails details = (ProductDetails)ctrl;
details.ItemID = elementID;
}
protected void RadListView1_ItemDataBound(object sender, RadListViewItemEventArgs e)
{
if (e.Item.ItemType == RadListViewItemType.DataItem || e.Item.ItemType == RadListViewItemType.AlternatingItem)
{
Control target = e.Item.FindControl("ItmImage");
if (!Object.Equals(target, null))
{
if (!Object.Equals(this.RadToolTipManager1, null))
{
// add to tooltip manager
string keyValue = (e.Item as RadListViewDataItem).GetDataKeyValue("ItemID").ToString();
this.RadToolTipManager1.TargetControls.Add(target.ClientID, keyValue, true);
}
}
}
}
protected void RadListView1_PageIndexChanged(object sender, RadListViewPageChangedEventArgs e)
{
if (e.CommandName == "Sort" || e.CommandName == "Page")
{
RadToolTipManager1.TargetControls.Clear();
}
RadListView1.CurrentPageIndex = e.NewPageIndex;
RadListView1.DataBind();
}
protected void MoreDetailsLinkButton_Click(object sender, EventArgs e)
{
LinkButton _moreDetailsLinkButton = (LinkButton)sender;
Session["itemId"] = null;
Session["itemId"] = (_moreDetailsLinkButton.FindControl("ItemIDLabel") as Label).Text.ToString();
Response.Redirect("~/Pages/MoreDetails/Dfos/Default.aspx");
}
public int getSrcImgDim(int maxDim, string _srcImgUrl, string dimType)
{
int[] _dim = new int[2];
int tempwidth = 0;
int tempHeight = 0;
System.Drawing.Image img = System.Drawing.Image.FromFile(Server.MapPath(_srcImgUrl));
_dim[0] = Convert.ToInt32(img.Size.Width);
_dim[1] = Convert.ToInt32(img.Size.Height);
if (_dim[0] > _dim[1])
{
tempwidth = maxDim;
float wrltn = ((float)_dim[0] / (float)maxDim);
tempHeight = (int)((float)_dim[1] / (float)wrltn);
}
else
{
tempHeight = maxDim;
float wrltn = ((float)_dim[1] / (float)maxDim);
tempwidth = (int)((float)_dim[0] / (float)wrltn);
}
if (dimType.Equals("width"))
{
return tempwidth;
}
else
{
return tempHeight;
}
}
protected void RadListView1_ItemCreated(object sender, RadListViewItemEventArgs e)
{
/*if (e.Item is RadListViewDataItem)
{
Panel _generalItemsPanel = e.Item.FindControl("GeneralItemsPanel") as Panel;
Panel _itemsPanel = e.Item.FindControl("ItemsPanel") as Panel;
switch (theBrowser)
{
case "Safari 4.0":
case "Safari 5.0": { _generalItemsPanel.Style.Add("margin-left", "23px"); break; }
case "Firefox 3.0":
case "Firefox 3.5":
case "Firefox 3.6": { _generalItemsPanel.Style.Add("margin-left", "-16px"); break; }
case "IE 6.0": { _generalItemsPanel.Style.Add("margin-left", "-3px"); break; }
case "IE 7.0": { _generalItemsPanel.Style.Add("margin-left", "-3px"); break; }
case "IE 8.0": { _generalItemsPanel.Style.Add("margin-left", "-3px"); break; }
case "Opera 9.80":
case "Opera 10.00": { _generalItemsPanel.Style.Add("margin-left", "15px"); break; }
case "Chrome 5.0":
case "Chrome 6.0": { _generalItemsPanel.Style.Add("margin-left", "15px"); break; }
default: { _generalItemsPanel.Style.Add("margin-left", "15px"); break; }
}
}*/
}
}
Plaese, I need to know why is this error is displayed and why the RadTooTip is not displayed.
It is appreciated to send me the moified code.
Regards,
Bader