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

grid that has a tooltip

2 Answers 54 Views
This is a migrated thread and some comments may be shown as answers.
Patricia Byrne
Top achievements
Rank 1
Patricia Byrne asked on 19 Jul 2010, 05:44 PM
I think what I'm asking is very basic but I can't figure out what I'm doing wrong.

I have a grid with a tooltip. I'm using the demo for the grid and tried to adjust it to work with my database. It's in vb. I'm getting the following error when I hover over a link that has the tooltip.:

Object references not set to an instance of an object. Thank you for any help.

asp.x page:
<%@ Register Src="ProductDetails.ascx" TagName="ProductDetails" TagPrefix="uc1" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "">
<html xmlns="">
<head runat="server">
    <link rel="Stylesheet" href="StyleSheet.css" />
<body class="BODY">
    <form id="Form1" method="post" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                    <telerik:AjaxUpdatedControl ControlID="RadToolTipManager1" />
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server">
    <telerik:RadToolTipManager ID="RadToolTipManager1" OffsetY="-1" HideEvent="ManualClose"
        Width="250" Height="350" runat="server" OnAjaxUpdate="OnAjaxUpdate" RelativeTo="Element"
    <telerik:RadGrid ID="RadGrid1" Width="550" runat="server" DataSourceID="SqlDataSource1"
        GridLines="None" OnItemDataBound="RadGrid1_ItemDataBound" AllowPaging="true"
        AllowSorting="true" PageSize="10" OnItemCommand="RadGrid1_ItemCommand">
        <MasterTableView AutoGenerateColumns="False" CommandItemDisplay="None" CurrentResetPageIndexAction="SetPageIndexToFirst"
            DataKeyNames="CustomerID" DataSourceID="SqlDataSource1" Dir="LTR" Frame="Border"
                <telerik:GridBoundColumn CurrentFilterFunction="NoFilter" DataField="CustomerID" Display="false"
                    DataType="System.Int32" FilterListOptions="VaryByDataType" ForceExtractValue="None"
                    HeaderText="ProductID" ReadOnly="True" SortExpression="CustomerID" UniqueName="CustomerID">
                <telerik:GridTemplateColumn HeaderText="Applicant" SortExpression="Applicant">
                        <asp:HyperLink ID="targetControl" runat="server" NavigateUrl="#" Text='<%# Eval("Applicant") %>'></asp:HyperLink>
                <telerik:GridBoundColumn AllowSorting="true" DataField="CompanyName" HeaderText="Supplier"
                    SortExpression="CompanyName" UniqueName="CompanyName">
                <telerik:GridBoundColumn AllowSorting="true" DataField="UnitPrice" DataFormatString="{0:C}"
                    HeaderText="Price" SortExpression="UnitPrice">
                <EditColumn CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType">
    <asp:SqlDataSource ID="SqlDataSource1" runat="server"
            ConnectionString="<%$ ConnectionStrings:BureauConnectionString %>"
            SelectCommand="SELECT * FROM [bureauSummary]"></asp:SqlDataSource>

vb code behind code:
Imports System.Web.SessionState
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.HtmlControls

Imports Telerik.Web.UI

Imports System.IO

Namespace Telerik.Web.Examples.ToolTip.TargetControlsAndAjax
    Partial Public Class DefaultVB
        Inherits System.Web.UI.Page
        Protected Sub OnAjaxUpdate(ByVal sender As Object, ByVal args As ToolTipUpdateEventArgs)
            Me.UpdateToolTip(args.Value, args.UpdatePanel)
        End Sub
        Private Sub UpdateToolTip(ByVal elementID As String, ByVal panel As UpdatePanel)
            Dim ctrl As Control = Page.LoadControl("ProductDetails.ascx")
            Dim details As ProductDetails = DirectCast(ctrl, ProductDetails)
            details.ProductID = elementID
        End Sub
        Protected Sub RadGrid1_ItemDataBound(ByVal sender As Object, ByVal e As GridItemEventArgs)
            If e.Item.ItemType = GridItemType.Item OrElse e.Item.ItemType = GridItemType.AlternatingItem Then
                Dim target As Control = e.Item.FindControl("targetControl")
                If Not [Object].Equals(target, Nothing) Then
                    If Not [Object].Equals(Me.RadToolTipManager1, Nothing) Then
                        'Add the button (target) id to the tooltip manager

                        Me.RadToolTipManager1.TargetControls.Add(target.ClientID, (TryCast(e.Item, GridDataItem)).GetDataKeyValue("CustomerID").ToString(), True)
                    End If
                End If
            End If
        End Sub
        Protected Sub RadGrid1_ItemCommand(ByVal source As Object, ByVal e As GridCommandEventArgs)
            If e.CommandName = "Sort" OrElse e.CommandName = "Page" Then
            End If

        End Sub
    End Class
End Namespace

ProductDetails.ascx  code:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ProductDetails.ascx.cs"
    Inherits="Telerik.Web.Examples.ToolTip.TargetControlsAndAjax.ProductDetails" %>

<table runat="server" style="width: 100%" id="ProductWrapper" border="0" cellpadding="2"
        <td style="text-align: center;">
            <asp:FormView ID="ProductsView" DataSourceID="ProductDataSource" DataKeyNames="CustomerID"
                runat="server" OnDataBound="ProductsView_DataBound">       
                    <asp:Label CssClass="title" ID="Category" runat="server"><%# Eval("CoApplicant")%></asp:Label>
                    <hr />
                    <span class='title'>Equifax:</span>
                    <asp:Label CssClass="info" ID="Label1" runat="server"><%# Eval("Equifax")%></asp:Label>
                    <br />
                    <span class='title'>Experian:</span>
                    <asp:Label CssClass="info" ID="Label2" runat="server"><%# Eval("Experian")%></asp:Label>
                    <br />
                    <span class='title'>ID/OFAC:</span>
                    <asp:Label CssClass="info" ID="Label3" runat="server"><%# Eval("IDOFACText")%></asp:Label>
                    <br />

<asp:SqlDataSource ID="ProductDataSource" runat="server"
    ConnectionString="<%$ ConnectionStrings:BureauConnectionString %>"
    SelectCommand="SELECT * FROM [bureauSummary] WHERE ([CustomerID] = @CustomerID)">
        <asp:Parameter Name="CustomerID" Type="Int32" />

ProductDetails.ascx  code:
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;
using System.Drawing;
using System.IO;

namespace Telerik.Web.Examples.ToolTip.TargetControlsAndAjax

    public partial class ProductDetails : System.Web.UI.UserControl

        public string ProductID
                if (ViewState["CustomerID"] == null)
                    return "";
                return (string)ViewState["CustomerID"];
                ViewState["CustomerID"] = value;

        protected void Page_Load(object sender, EventArgs e)
            this.ProductDataSource.SelectParameters["CustomerID"].DefaultValue = this.ProductID;




2 Answers, 1 is accepted

Sort by
Telerik team
answered on 22 Jul 2010, 11:57 AM
Hello Patricia,

I have reviewed your code and I was not able to find any mistakes in it.
If the issue persists, please open a formal support ticket and send us a small working project, demonstrating your full setup and showing the unwanted behavior.
We will debug it locally and get back to you.

Thank you in advance for the cooperation.

the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Patricia Byrne
Top achievements
Rank 1
answered on 22 Jul 2010, 01:39 PM

Thank you for your reply. I will setup a support ticket.

Asked by
Patricia Byrne
Top achievements
Rank 1
Answers by
Telerik team
Patricia Byrne
Top achievements
Rank 1
Share this question