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

OnAjaxUpdate Error in Tooltip RadGrid

1 Answer 105 Views
ToolTip
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:

Default.aspx
<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"    > 
             <Columns> 
               
            <telerik:GridBoundColumn HeaderText="Terminal" DataField="NodeName" SortExpression="NodeName" ItemStyle-Wrap="false"   
                     ItemStyle-HorizontalAlign="Center" UniqueName="DisplayName">  
                <ItemStyle HorizontalAlign="Left" Wrap="False" /> 
                 </telerik:GridBoundColumn> 
            <telerik:GridBoundColumn HeaderText="IP Address" DataField="IPAddress" SortExpression="IPAddress" ItemStyle-Wrap="false"   
                     ItemStyle-HorizontalAlign="Center" UniqueName="IpAddress" HeaderStyle-HorizontalAlign="Center" AllowSorting="false" > 
                 </telerik:GridBoundColumn> 
                        
                       <telerik:GridBoundColumn HeaderText="Last Online Time" SortExpression="LastOnline"  ItemStyle-Wrap="false" ItemStyle-HorizontalAlign="Center" UniqueName="LastOnlineTime" HeaderStyle-HorizontalAlign="Center" AllowSorting="false" > 
                 </telerik:GridBoundColumn> 
                    
                  <telerik:GridTemplateColumn HeaderText="Product" SortExpression="ProductName">  
                    <ItemTemplate> 
                        <asp:HyperLink ID="targetControl" runat="server" NavigateUrl="#"><img src="Style/Images/page2.gif" border="0" /></asp:HyperLink> 
                    </ItemTemplate> 
                </telerik:GridTemplateColumn>          
               
                         
             </Columns> 
             <RowIndicatorColumn> 
                        <HeaderStyle Width="20px" /> 
                    </RowIndicatorColumn> 
                    <ExpandCollapseColumn> 
                        <HeaderStyle Width="20px" /> 
                    </ExpandCollapseColumn> 
                </MasterTableView> 
                <ClientSettings EnableRowHoverStyle="true" >  <Selecting AllowRowSelect="true"/>  
                                   
                  <ClientEvents OnRowCreated="RadGrid1_RowCreated" OnRowDeSelected="RadGrid1_RowDeselected" OnRowSelected="RadGrid1_RowSelected" OnRowContextMenu="RowContextMenu" /> 
                      
                    </ClientSettings> 
                  
                 </telerik:RadGrid> 
      
   
       
     
   <asp:Timer ID="Timer1" runat="server" EnableViewState="False" Interval="500000" OnTick="Timer1_Tick">  
        </asp:Timer> 
      
     </telerik:RadAjaxPanel> 
 
      
   
     
    <telerik:RadAjaxManager ID="RadAjaxManager2" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1">  
       <AjaxSettings> 
           <telerik:AjaxSetting AjaxControlID="Timer1">  
               <UpdatedControls> 
                   <telerik:AjaxUpdatedControl ControlID="AjaxPanel" /> 
               </UpdatedControls> 
               <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                    <telerik:AjaxUpdatedControl ControlID="RadToolTipManager1" /> 
                </UpdatedControls> 
 
           </telerik:AjaxSetting> 
       </AjaxSettings> 
    </telerik:RadAjaxManager> 
      
    <telerik:RadToolTipManager ID="RadToolTipManager1" OffsetY="-1" HideEvent="ManualClose"   
        Width="250" Height="350" runat="server"  RelativeTo="Element"  OnAjaxUpdate="OnAjaxUpdate"   
        Position="MiddleRight" > 
    </telerik:RadToolTipManager> 
 
 
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Transparency="30" CssClass="LoadingPanel" > 
    </telerik:RadAjaxLoadingPanel> 
     

Default.aspx.vb
 
    Private Sub UpdateToolTip(ByVal elementID As StringByVal panel As UpdatePanel)  
        Dim ctrl As Control = Page.LoadControl("ctrlGridRowDetail.ascx")  
        panel.ContentTemplateContainer.Controls.Add(ctrl)  
        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)  
        RadToolTipManager1.TargetControls.Clear()  
End Sub 

Controls
<%@ 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 
        Get 
            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  
                 BindNodeInfo()  
 
    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
0
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,
Svetlina
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.
Tags
ToolTip
Asked by
Pei Chen
Top achievements
Rank 1
Answers by
Svetlina Anati
Telerik team
Share this question
or