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

OnAjaxUpdate Error in Tooltip RadGrid

1 Answer 105 Views
This is a migrated thread and some comments may be shown as answers.
Pei Chen
Top achievements
Rank 1
Pei Chen asked on 09 Apr 2010, 08:47 PM
I basically want to use the Tool / ToolTipified Grid from the Telerik, I followed pretty much the same instructions with a bit of differences in ascx.  But it gave me the error:

RadToolTipManager response error:
Exception=Sys.WebForms.PageRequetManagerServerErrorException: Object reference not set to an instance of an object.

And the tooltip fires but content is not populated.

Below are my codes:

<telerik:RadAjaxPanel runat="server" ID="AjaxPanel">         
         <telerik:RadGrid  ID="RadGrid1" runat="server" AllowMultiRowSelection="true" 
                AllowSorting="True" AutoGenerateColumns="False" GridLines="Both"    
                Skin="Black" SelectedItemStyle-ForeColor="Aqua" OnSortCommand="RadGrid1_SortCommand">  
             <MasterTableView  ClientDataKeyNames="NodeName" RowIndicatorColumn-Display="false" TableLayout="Auto" AllowMultiColumnSorting="true" DataKeyNames="NodeName"    > 
            <telerik:GridBoundColumn HeaderText="Terminal" DataField="NodeName" SortExpression="NodeName" ItemStyle-Wrap="false"   
                     ItemStyle-HorizontalAlign="Center" UniqueName="DisplayName">  
                <ItemStyle HorizontalAlign="Left" Wrap="False" /> 
            <telerik:GridBoundColumn HeaderText="IP Address" DataField="IPAddress" SortExpression="IPAddress" ItemStyle-Wrap="false"   
                     ItemStyle-HorizontalAlign="Center" UniqueName="IpAddress" HeaderStyle-HorizontalAlign="Center" AllowSorting="false" > 
                       <telerik:GridBoundColumn HeaderText="Last Online Time" SortExpression="LastOnline"  ItemStyle-Wrap="false" ItemStyle-HorizontalAlign="Center" UniqueName="LastOnlineTime" HeaderStyle-HorizontalAlign="Center" AllowSorting="false" > 
                  <telerik:GridTemplateColumn HeaderText="Product" SortExpression="ProductName">  
                        <asp:HyperLink ID="targetControl" runat="server" NavigateUrl="#"><img src="Style/Images/page2.gif" border="0" /></asp:HyperLink> 
                        <HeaderStyle Width="20px" /> 
                        <HeaderStyle Width="20px" /> 
                <ClientSettings EnableRowHoverStyle="true" >  <Selecting AllowRowSelect="true"/>  
                  <ClientEvents OnRowCreated="RadGrid1_RowCreated" OnRowDeSelected="RadGrid1_RowDeselected" OnRowSelected="RadGrid1_RowSelected" OnRowContextMenu="RowContextMenu" /> 
   <asp:Timer ID="Timer1" runat="server" EnableViewState="False" Interval="500000" OnTick="Timer1_Tick">  
    <telerik:RadAjaxManager ID="RadAjaxManager2" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1">  
           <telerik:AjaxSetting AjaxControlID="Timer1">  
                   <telerik:AjaxUpdatedControl ControlID="AjaxPanel" /> 
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                    <telerik:AjaxUpdatedControl ControlID="RadToolTipManager1" /> 
    <telerik:RadToolTipManager ID="RadToolTipManager1" OffsetY="-1" HideEvent="ManualClose"   
        Width="250" Height="350" runat="server"  RelativeTo="Element"  OnAjaxUpdate="OnAjaxUpdate"   
        Position="MiddleRight" > 
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Transparency="30" CssClass="LoadingPanel" > 

    Private Sub UpdateToolTip(ByVal elementID As StringByVal panel As UpdatePanel)  
        Dim ctrl As Control = Page.LoadControl("ctrlGridRowDetail.ascx")  
        Dim details As ctrlGridRowDetail = DirectCast(ctrl, ctrlGridRowDetail)  
        details.rowID = elementID  
    End Sub 
    Sub OnAjaxUpdate(ByVal sender As ObjectByVal args As ToolTipUpdateEventArgs)  
        Me.UpdateToolTip(args.Value, args.UpdatePanel)  
    End Sub 
 Private Sub RadGrid1_ItemDataBound(ByVal sender As ObjectByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemDataBound  
        If (TypeOf (e.Item) Is GridDataItem) Then 
            Dim target As Control = e.Item.FindControl("targetControl")  
            If Not [Object].Equals(target, NothingThen 
                If Not [Object].Equals(Me.RadToolTipManager1, NothingThen 
                    Me.RadToolTipManager1.TargetControls.Add(target.ClientID, (TryCast(e.Item, GridDataItem)).GetDataKeyValue("NodeName").ToString(), True)  
                End If 
            End If 
        End If 
    End Sub 
 Protected Sub RadGrid1_SortCommand(ByVal source As ObjectByVal e As Telerik.Web.UI.GridSortCommandEventArgs)  
End Sub 

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ctrlGridRowDetail.ascx.vb" Inherits="ClientWebApp.ctrlGridRowDetail" %> 
  <asp:Label runat="server" ID="lblTitle"></asp:Label> 
  <asp:Label ID="lblAttribute" runat="server"></asp:Label> 

 Private row As String 
    Property rowID() As String 
            Return row  
        End Get 
        Set(ByVal value As String)  
            row = value  
        End Set 
    End Property 
    Protected Sub Page_Load(ByVal sender As ObjectByVal e As System.EventArgs) Handles Me.Load  
    End Sub 
    Protected Sub BindNodeInfo()  
                 <<-- Populate Data here and attach result to a string builder -->   
                lblAttribute.Text = sb.ToString()  
    End Sub 

1 Answer, 1 is accepted

Sort by
Svetlina Anati
Telerik team
answered on 13 Apr 2010, 02:41 PM
Hello Pei,

The code snippet you have pasted seems to be correct. What I can suggest is to first remove all the ajax settings and set debug="true" in the Web.config. This will show what causes the server error and you will be able to see which exact element is null. After that you can set a breakpoint and debug the server code.

Sincerely yours,
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.
Asked by
Pei Chen
Top achievements
Rank 1
Answers by
Svetlina Anati
Telerik team
Share this question