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

OnAjaxUpdate not fired on RadDataGrid Cells

1 Answer 114 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 01 Dec 2008, 02:57 PM
Hi,
I would like to display dynamically ToolTip on each RadDataGrid Cells.
To do that, i use the RadToolTipManager like this:

<asp:Label id="fakeControl" runat="server"></asp:Label> 
<telerik:RadToolTipManager ID="JMRadToolTipManager" runat="server" 
 Position="BottomRight" Animation="Fade"  AutoTooltipfy="False" Skin="Default" 
 OnAjaxUpdate="JMRadToolTipManager_OnAjaxUpdate"
  <TargetControls>                                 
    <telerik:ToolTipTargetControl IsClientID="true" TargetControlID="fakeControl"/> 
  </TargetControls> 
</telerik:RadToolTipManager>  

( My Grid are populated with Ajax method after selection some criterias. )
My Telerik:DataGrid componement are wrapped in "asp:UpdatePanel"
On this DataGrid, i'm setting an "onitemdatabound" attribute.
Here, the squeleton of my ASPX code:

<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" > 
<ContentTemplate>   
   <asp:Label id="fakeControl" runat="server"></asp:Label> 
   <telerik:RadToolTipManager>...</telerik:RadToolTipManager> 
    
 <telerik:RadGrid ID="JMRadGridResultstatGlobal" runat="server" 
      meta:resourcekey="JMRadGridResultstatGlobalResource1"  
      onitemdatabound="JMRadGridResultstatGlobal_ItemDataBound"
  <Columns> 
   <telerik:GridBoundColumn AllowFiltering="False" AllowSorting="False" 
     DataField="PartyGroupName" Groupable="False" HeaderText="POLES"   
      UniqueName="PartyGroupName" meta:resourcekey="GridBoundColumnResource5"
     <HeaderStyle Width="200px" /> 
     <ItemStyle Width="200px"  HorizontalAlign="Left" VerticalAlign="Middle" /> 
     </telerik:GridBoundColumn> 
     <telerik:GridTemplateColumn AllowFiltering="False" DataType="System.Int64" 
           DataField="OnTimeCount" Groupable="False" HeaderText="Nbr OK"  
           UniqueName="OnTimeCount" > 
       <ItemTemplate> 
       <asp:Label ID="lblOnTimeCount" runat="server" Text='<%#Eval("OnTimeCount") %>' meta:resourcekey="GridBoundColumnResource6"
      </asp:Label> 
      </ItemTemplate> 
      <HeaderStyle Width="30px" /> 
      <ItemStyle Width="30px" HorizontalAlign="Center" VerticalAlign="Middle" />  
... 
      </columns> 
.... 
  </telerik:RadGrid> 
 
 </ContentTemplate> 
</asp:UpdatePanel> 
 
  
 
 
</telerik:RadGrid> 


The ItemDataBound is correctly fired when i populating column on my DataGrid (with RadAjaxManager telerik componment)
In this method, for each DataGrid Cells iterated, i add there clientId property to the TargetControl Collection on my RadToolTipManager like this:


protected void JMRadGridResultstatGlobal_ItemDataBound(object sender, GridItemEventArgs e) 
        { 
            string clientID = string.Empty; 
 
            if ((e.Item.ItemType == GridItemType.AlternatingItem) || (e.Item.ItemType == GridItemType.Item)) 
            { 
                foreach (GridColumn column in e.Item.OwnerTableView.RenderColumns) 
                { 
                    string monitoringName = e.Item.Cells[2].Text; 
                    string slotType = string.Empty; 
                    if (column is GridTemplateColumn) 
                    { 
                        switch (column.OrderIndex) 
                        { 
                            case 3:                              
                                clientID = e.Item.Cells[column.OrderIndex].FindControl("lblLateCount").ClientID; 
                                //((Label)e.Item.Cells[column.OrderIndex].FindControl("lblLateCount")).ToolTip = "ClientId:" + e.Item.Cells[column.OrderIndex].FindControl("lblLateCount").ClientID + ""; 
                                slotType = ResultContainer.SlotTypeList.NO_EXPORT.ToString(); 
                                break; 
                            case 4: 
                                clientID = e.Item.Cells[column.OrderIndex].FindControl("lblOnTimeCount").ClientID; 
                                //((Label)e.Item.Cells[column.OrderIndex].FindControl("lblOnTimeCount")).ToolTip = "ClientId:" + e.Item.Cells[column.OrderIndex].FindControl("lblOnTimeCount").ClientID + ""; 
                                slotType = ResultContainer.SlotTypeList.AHEAD.ToString(); 
                                break; 
                            case 5: 
                                clientID = e.Item.Cells[column.OrderIndex].FindControl("lblAheadCount").ClientID; 
                                //((Label)e.Item.Cells[column.OrderIndex].FindControl("lblAheadCount")).ToolTip = "ClientId:" + e.Item.Cells[column.OrderIndex].FindControl("lblAheadCount").ClientID + ""; 
                                slotType = ResultContainer.SlotTypeList.LATE.ToString(); 
                                break; 
                            case 6: 
                                clientID = e.Item.Cells[column.OrderIndex].FindControl("lblNoExportCount").ClientID; 
                                //((Label)e.Item.Cells[column.OrderIndex].FindControl("lblNoExportCount")).ToolTip = "ClientId:" + e.Item.Cells[column.OrderIndex].FindControl("lblNoExportCount").ClientID + ""; 
                                slotType = ResultContainer.SlotTypeList.ON_TIME.ToString(); 
                                break; 
                            default: 
                                break; 
                        }                                                                                                                        
 
                        JMRadToolTipManager.TargetControls.Add(clientID, monitoringName + "|" + slotType, true);                         
                    } 
                } 
                 
            } 
            JMRadToolTipManager.DataBind(); 
 
        } 


To test my program, i'm setting a BreakPoint to my "JMRadToolTipManager_OnAjaxUpdate" method which is theorically fired when i mouve my mouse over each Cells of my DataGrid.
This method is never fired!!!!!!!!!

Here , the contents of this method:

protected void JMRadToolTipManager_OnAjaxUpdate(object sender, ToolTipUpdateEventArgs args) 
        { 
            Control ctrl = Page.LoadControl("CustomersList.ascx"); 
            args.UpdatePanel.ContentTemplateContainer.Controls.Add(ctrl); 
            CustomersList details = (CustomersList)ctrl; 
 
            if ((args.Value != null) && (args.Value.Length > 1)) 
            { 
                details.MonitoringName = (args.Value.Split('|'))[0]; 
                details.Slot = (args.Value.Split('|'))[1]; 
            } 
        } 


Note: I use Fake control setting in my code like mentioned in many post of you forums to workAround the problem of TargetCollection Empty which fired the OnAjaxUpdate method on each componement of my ASPX Page.

Could you help me please.

Thank

1 Answer, 1 is accepted

Sort by
0
Svetlina Anati
Telerik team
answered on 04 Dec 2008, 09:28 AM
Hi David,

I examined your code and I could not notice the RadAjaxmanager you are talking for - I can only see an update panel control. However, the code is not enough to find the problem, I assume that it is most probably caused by adding wrong IDs to the TargetControls collection or not synchronized update of the grid and the manager. If you need further assistance, please prepare a fully runnable sample demo (including DB, e.g use Northwind), open a new support ticket and send it to me along with your explanation. Once I receive it I will analyze and debug the project and I will be able to help you resolve the issue.

Sincerely yours,
Svetlina
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
ToolTip
Asked by
David
Top achievements
Rank 1
Answers by
Svetlina Anati
Telerik team
Share this question
or