簡體   English   中英

使用自定義asp.net .ashx圖像處理程序時未顯示RadToolTip

[英]RadToolTip not showing when using a custom asp.net .ashx image handler

您好,我正在使用RadToolTip。

<asp:Image ID="imgMain" runat="server"/>
    <telerik:RadToolTip ID="RadToolTip2" runat="server" TargetControlID="imgMain" Width="400px" RelativeTo="Element" EnableShadow="true" Position="BottomCenter" Animation="Slide"            AnimationDuration="300" ShowDelay="200" Skin="Vista" HideEvent="LeaveToolTip">
    </telerik:RadToolTip>

我還在運行時在RadToolTip中添加了一個Image,該Image的ImageUrl是通過我自己的自定義Image Handler設置的,該自定義Image Handler在站點中使用並且可以正常工作。

當用戶將鼠標懸停在“ imgMain”上時,RadToolTip應該顯示相同的圖像,但大小不同,但所獲得的只是RadToolTip顯示標題。 如果我將代碼硬編碼到RadToolTip內的圖像中,則可以正常顯示,因此我知道它與ImageHandler無關。

從RadToolTip內部的圖像處理程序動態顯示圖像是否存在任何已知問題?

我的服務器端代碼如下

imgMain.ImageUrl = String.Format("~/dbimagehandler.ashx?record=product&empty=showt&imageno=1&recno=-1&wid={0}&hgt={1}&productid={2}", "188", "196", this.ProductId)

imgMain.AlternateText = ds.Ds.Tables["Table"].Rows[0]["Title"].ToString();
imgMain.ToolTip = ds.Ds.Tables["Table"].Rows[0]["Title"].ToString();

RadToolTip2.TargetControlID = imgMain.ID;
Image imgsmall = new Image();
imgsmall.ImageUrl = String.Format("~/dbimagehandler.ashx?record=product&empty=showt&imageno=1amprecno=-1&wid={0}&hgt={1}&productid={2}", "376","392", this.ProductId);
RadToolTip2.Controls.Add(imgsmall);

在這方面的任何幫助將不勝感激。

不知道您是否已經這樣做了,但是請確保后面的代碼中包含以下類型的代碼(我使用C#)

private void LoadTree()
{
      RadToolTipManager1.ShowDelay = 100;
      RadToolTipManager1.HideDelay = 100;
      RadToolTipManager1.AutoCloseDelay = 8000;
      RadToolTipManager1.TargetControls.Add("<ID Of the Control where you wish to diplay the rad tool tip>");
}

這可能會有所幫助。 在最近的一些更新之后,我注意到RadToolTips的一些時髦行為...所以我去了帶有Ajax更新的RadToolTipManager。 只需將您的處理程序代碼放入Ajax事件即可。

http://trappedinhoth.blogspot.com/2014/05/fixing-teleriks-radtooltip-after-latest.html

希望對您有所幫助。

在什么情況下,您將此圖像添加到工具提示中? 如果它在AJAX請求中,請確保也更新了工具提示。 您還可以檢查net選項卡,以查看對圖像的請求是否實際上返回了圖像而不是404,這是丟失圖像的很好原因。

您還可以嘗試將圖像放在標記中,並僅從服務器設置它的URL,或者甚至通過客戶端上的JavaScript設置(例如,在OnClientShow事件中,通過將URL存儲在隱藏字段中)。

您還可以查看RadToolTipManager提供的按需加載,例如從telerik演示站點(例如此處) ,因為它非常適合動態創建圖像的方式。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM