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

Step 1

9 Answers 788 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
Peter
Top achievements
Rank 1
Peter asked on 31 Jan 2008, 08:52 PM
I'm trying to implement tooltips to links in a datalist, but it doesn't even seem to be trying to work.

I've read, re-read and scoured the demos and forums to no avail.
Steps I've taken;

1) Add a ScriptManager to the page.
2) Add a Tooltip to the page.
3) Set the TargetControlID.
4) Set IsClientID to true
5) Try to run the page.

It's not throwing any errors, just simply not showing up.
More info available as well.

Any help would be greatly appreciated.

9 Answers, 1 is accepted

Sort by
0
Peter
Top achievements
Rank 1
answered on 01 Feb 2008, 03:52 PM
Guess not.
0
Tsvetie
Telerik team
answered on 01 Feb 2008, 05:26 PM
Hello Peter,
If I understand you correctly, you have added a RadToolTip (not RadToolTipManager) and you have set its TargetControlID to the ID of the DataList. However, this means that you have tooltipified the DataList itself, and not its child LinkButton controls. In order to achieve the desired result, you should use the RadToolTipManager and add the ID of every LinkButton from the DataList item to its TargetControls collection (you can use the ItemDataBound event to do so).

Greetings,
Tsvetie
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Peter
Top achievements
Rank 1
answered on 01 Feb 2008, 05:45 PM
Actually, I was setting the TargetControlID to the ID of the control in the Datalist (an asp:image).  I also tried to use the ToolTipManager instead of the ToolTip, however my results were the same.

However, I wasn't adding anything into the code-behind file. (.aspx.vb)
Could you give me a short example?

Also, I found that I was using an Atlas ScriptManager, and not the RadScriptManager, would that make a difference?

However, if I try to replace it with the Rad version, I get this error.

"System.InvalidOperationException: '~/Telerik.Web.UI.WebResource.axd' is missing in web.config. RadScriptManager requires a HttpHandler registration in web.config. Please, use the control Smart Tag to add the handler automatically, or see the help for more information: Controls > RadScriptManager"


0
Peter
Top achievements
Rank 1
answered on 01 Feb 2008, 05:46 PM
And thank you for your response, your help is much appreciated.
0
Fernandes
Top achievements
Rank 1
answered on 01 Feb 2008, 07:38 PM

Hi Peter,

I've created a sample page. It uses the Northwind database.

Take a look, and see how it goes :)

The aspx:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="tooltipDataList.aspx.cs" Inherits="tooltipDataList" %> 
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<html xmlns="http://www.w3.org/1999/xhtml" > 
<head runat="server">  
    <title>Tooltip on DataList</title> 
</head> 
<body> 
    <form id="form1" runat="server">  
    <asp:ScriptManager ID="ScriptManager1" runat="server" />      
        <telerik:radtooltipmanager id="RadToolTipManager1" runat="server"></telerik:radtooltipmanager> 
    <div> 
        <asp:DataList ID="DataList1" runat="server" DataKeyField="ProductID" DataSourceID="SqlDataSource1" OnItemDataBound="DataList1_ItemDataBound">  
            <ItemTemplate> 
                ProductID:  
                <asp:Label ID="ProductIDLabel" runat="server" Text='<%# Eval("ProductID") %>'></asp:Label><br /> 
                ProductName:  
                <asp:HyperLink ID="ProductNameHyperLink" runat="server" Text='<%# Eval("ProductName") %>' ></asp:HyperLink> 
                <br /> 
                UnitPrice:  
                <asp:Label ID="UnitPriceLabel" runat="server" Text='<%# Eval("UnitPrice") %>'></asp:Label><br /> 
                <br /> 
            </ItemTemplate> 
        </asp:DataList></div>  
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>" 
            SelectCommand="SELECT TOP 5 ProductID, ProductName, UnitPrice FROM Products"></asp:SqlDataSource> 
    </form> 
</body> 
</html> 


And the Code behind:
using System;  
using System.Data;  
using System.Configuration;  
using System.Collections;  
using System.Web;  
using System.Web.Security;  
using System.Web.UI;  
using System.Web.UI.WebControls;  
using System.Web.UI.WebControls.WebParts;  
using System.Web.UI.HtmlControls;  
 
 
public partial class tooltipDataList : System.Web.UI.Page  
{  
    protected void Page_Load(object sender, EventArgs e)  
    {  
 
    }  
    protected void DataList1_ItemDataBound(object sender, DataListItemEventArgs e)  
    {  
        DataRowView drv = (DataRowView)e.Item.DataItem;  
 
        // Get the HyperLink  
        HyperLink hlk = (HyperLink)e.Item.FindControl("ProductNameHyperLink");  
        hlk.NavigateUrl = "~/productDetails.aspx?id=" + drv["ProductID"].ToString();  
        hlk.ToolTip = "This is Tooltip for Product # " + drv["ProductID"].ToString();  
 
        // Add the tooltip to the Hyperlink         
        RadToolTipManager1.TargetControls.Add(hlk.ClientID, true);  
    }  

Fernandes
0
Peter
Top achievements
Rank 1
answered on 01 Feb 2008, 07:55 PM
I tried implementing your code into my project, to no avail.
I'm really stumped here, as it's not throwing any errors, just doing nothing.

I could e-mail you some code if you'd like.
This is so aggravating, because I'm sure it's something simple, but I just can't seem to wrap my head around it.
0
Fernandes
Top achievements
Rank 1
answered on 04 Feb 2008, 10:59 AM
Hi Peter,

I've re-checked with a brand new web site and it worked. Maybe you're missing the database configuration settings on web.config.

Nevertheless, here are the steps to run the code (I'm assuming you have sql server on your machine, otherwise change the connectionstring on the aspx file)

1- Crete a new Ajax enabled web site.
2- Add references to Telerik.Web.UI.dll (and Telerik.Web.Design.dll)
3- Add a new webpage called tooltipDataList.aspx (make it default page)
4- Copy and paste the code above (for aspx and code-behind).

5- Remove the current sqlDataSource1. Replace it with:
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="Data Source=PORTOSANTO;Initial Catalog=Northwind;Integrated Security=True" 
            ProviderName="System.Data.SqlClient" SelectCommand="SELECT TOP 5 ProductID, ProductName, UnitPrice FROM Products">  
        </asp:SqlDataSource> 

6- The VS will ask you if you want to refresh the datalist layout. Say "No".

7- Run it.

8- Let me know how it goes. (This one is optional) :)

Fernandes




0
Peter
Top achievements
Rank 1
answered on 04 Feb 2008, 01:27 PM
Hi, thanks again for your reply.
Your code does indeed work when I create a new AJAX-enabled web site, however when I try to add it into my existing project, it errors out.

I've followed ALL of the steps for enabling your existing website for AJAX, however I'm now throwing this error in my web.config file.

Unrecognized configuration section system.web.extensions.

I've been searching, but am unable to find a solution.
My current project is using non-Prometheus telerik controls in other pages, and this is my first attempt to use any Prometheus controls.
Could that be why?
0
Accepted
Svetlina Anati
Telerik team
answered on 04 Feb 2008, 03:24 PM
Hi Peter,

When you open a blank AJAX - Enabled Web Site, VS.NET automatically adds a lot of additional information in the Web.config file, for example in the <configuration> section. I suppose that this causes your problem when trying to enable AJAX in your project.

I suggest you to open a new AJAX - Enabled Web Site and copy its web.config file's content to the web.config file of your existing site. Then add the connection strings information (and all other modification that you have done in your previous web.config) in the modified web.config. Also make sure that you have all the needed references in your bin folder and in your pages.

If you still experience problems, please open a new support ticket and send us a sample project where the problem can be reproduced - we will check it and do our best to help.



Greetings,
Svetlina
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
ToolTip
Asked by
Peter
Top achievements
Rank 1
Answers by
Peter
Top achievements
Rank 1
Tsvetie
Telerik team
Fernandes
Top achievements
Rank 1
Svetlina Anati
Telerik team
Share this question
or