Hi Guys,
After sorting out my recent problems getting radtooltip to work inside a datalist I found out i can't use Load on Demand with a tootip, only with a tooltip manager so I have had to rewrite it all to get it working. However I am having lots of problems.
First of all here is my code.
I should explain that line 21 uses a function of our own data layer. My problems are as follows....
1) When i remove the OnAjaxUpdate="OnAjaxUpdate" the page works. It shows a blank tooltip when you click on each photo. However, when I add the OnAjaxUpdate back in it stops working. The tooltips show for half a second then disappear again.
It does this in Firefox and IE and does it when i take all of the code out of the onajaxupdate sub too so the problem doesn't seem to be with the contents of that sub.
2) Because I am now using a radtooltipmanager rather than a radtooltip inside the datalist i have no idea how to change the title of the tooltip to the "Caption" I am getting from the database. When I was using a tooltip in the datalist I just did this...
Title='<%# DataBinder.Eval(Container.DataItem, "Caption") %>'
3) I copied the OnAjaxUpdate Sub from a telerik example but have no idea what it is doing. WHy is ElementID declared and then not used ? And what is args.UpdatePanel.ContentTemplateContainer.Controls.Add ? Does the Tooltip have it's own updatepanel inside it ?
Any help would be really appreciated as I just don't understand the online demos or the documentation. A very simple example would be useful to many others I'd guess.
Thanks, Jon
After sorting out my recent problems getting radtooltip to work inside a datalist I found out i can't use Load on Demand with a tootip, only with a tooltip manager so I have had to rewrite it all to get it working. However I am having lots of problems.
First of all here is my code.
| <%@ Page Language="VB" MasterPageFile="Master.master" %> | |
| <%@ MasterType virtualPath="Master.master"%> | |
| <%@ Import Namespace="System.Configuration.ConfigurationManager" %> | |
| <%@ Import Namespace="System.Data" %> | |
| <%@ Import Namespace="System.Data.SqlClient" %> | |
| <%@ Import Namespace="System.collections.Generic" %> | |
| <%@ Import Namespace="Tvi" %> | |
| <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> | |
| <script runat="server"> | |
| Dim Reader As SqlDataReader | |
| Dim Files As String = AppSettings("files_url") | |
| Sub Page_Load() | |
| MyRepeater.DataSource = Database.getDataReader("SELECT TOP 10 Caption, Thumbnail FROM Photos") | |
| MyRepeater.DataBind() | |
| End Sub | |
| Sub MyRepeaterBound(ByVal sender As Object, ByVal e As RepeaterItemEventArgs) | |
| If e.Item.ItemType = ListItemType.AlternatingItem OrElse e.Item.ItemType = ListItemType.Item Then | |
| Dim TempImage As Image = DirectCast(e.Item.FindControl("MyImage"), Image) | |
| Dim ClientID As String = TempImage.ClientID | |
| CommentToolTip.TargetControls.Add(ClientID, True) | |
| End If | |
| End Sub | |
| Protected Sub OnAjaxUpdate(ByVal sender As Object, ByVal args As ToolTipUpdateEventArgs) | |
| Dim elementID As String = args.TargetControlID | |
| 'Add content when necessary | |
| args.UpdatePanel.ContentTemplateContainer.Controls.Add(New HtmlGenericControl("HR")) | |
| End Sub | |
| </script> | |
| <asp:Content ID="Content" ContentPlaceHolderID="Content" runat="server"> | |
| <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager> | |
| <asp:UpdatePanel ID="UpdatePanel1" runat="server"> | |
| <ContentTemplate> | |
| <asp:repeater runat="server" id="MyRepeater" onitemdatabound="MyRepeaterBound"> | |
| <itemtemplate> | |
| <asp:image runat="server" id="MyImage" imageurl='<%# Files + DataBinder.Eval(Container.DataItem, "Thumbnail")%>'/> | |
| </itemtemplate> | |
| </asp:repeater> | |
| </ContentTemplate> | |
| </asp:UpdatePanel> | |
| <telerik:radtooltipmanager | |
| runat="server" | |
| id="CommentToolTip" | |
| ManualClose="true" | |
| Sticky="true" | |
| Title="Hello" | |
| Skin="Web20" | |
| Width="350px" | |
| Height="250px" | |
| Position="MiddleRight" | |
| OffsetX="6" | |
| Animation="Fade" | |
| OnAjaxUpdate="OnAjaxUpdate"> | |
| </telerik:radtooltipmanager> | |
| </asp:Content> |
I should explain that line 21 uses a function of our own data layer. My problems are as follows....
1) When i remove the OnAjaxUpdate="OnAjaxUpdate" the page works. It shows a blank tooltip when you click on each photo. However, when I add the OnAjaxUpdate back in it stops working. The tooltips show for half a second then disappear again.
It does this in Firefox and IE and does it when i take all of the code out of the onajaxupdate sub too so the problem doesn't seem to be with the contents of that sub.
2) Because I am now using a radtooltipmanager rather than a radtooltip inside the datalist i have no idea how to change the title of the tooltip to the "Caption" I am getting from the database. When I was using a tooltip in the datalist I just did this...
Title='<%# DataBinder.Eval(Container.DataItem, "Caption") %>'
3) I copied the OnAjaxUpdate Sub from a telerik example but have no idea what it is doing. WHy is ElementID declared and then not used ? And what is args.UpdatePanel.ContentTemplateContainer.Controls.Add ? Does the Tooltip have it's own updatepanel inside it ?
Any help would be really appreciated as I just don't understand the online demos or the documentation. A very simple example would be useful to many others I'd guess.
Thanks, Jon