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

RE: Forum -- Tooltip manager in radgrid - detail grid in tooltip

2 Answers 61 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Laura
Top achievements
Rank 1
Laura asked on 28 Nov 2008, 09:11 PM
I'm sorry that this is the second time I have to create a new thread on an already opened question that I posted a few days ago, but this is the second time I cannot follow the link from the email response to my question. Yesterday I had to start another thread also, and now I can follow the second followup on it. I get an internal error and also do not see the post when I search for it. tti

Before I post the prior stuff for it, I am getting the same error using the sample code that Shinu gave me as I did before. There error I am getting is A control is already associated with the element and it seems like it does not have anything to do with the grid. The resonse I got from Shinu was:

First you need to make sure that the tooltip is coming correctly when hover the link, try the folowing trick to test whether it is appearing correctly. place the aliasGrid  inside one panel, put one label also to test whether the arg values are coming passing correctly.

I don't know how to tell if it is appearing correctly...all i know is I am getting the same error as before and the code that is throwing  the error is:

]);

if (e) throw e;

 

 

if (typeof(element.control) != 'undefined') throw Error.invalidOperation(Sys.Res.controlAlreadyDefined);

 

Sys.UI.Control.initializeBase(

this);

 

 

this._element = element;

 

element.control =

this;

 




My code looks like this:


      
        protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)  
        {  
            Label Label1 = (Label)e.Item.FindControl("Label1");  
 
            //Add the Label id to the tooltip manager    
            try 
            {  
                System.Data.DataRowView currentRow = (System.Data.DataRowView)e.Item.DataItem;  
                this.RadToolTipManager1.TargetControls.Add(Label1.ClientID, currentRow.Row["provider_id"].ToString(), true);  
            }  
            catch (Exception e1)  
            {  
            }  
 
             
 
        }  
        protected void OnAjaxUpdate(object sender, ToolTipUpdateEventArgs args)  
        {  
            this.updateToolTip(args.Value, args.UpdatePanel);  
        }  
       
        protected void updateToolTip(string elementID, UpdatePanel panel)  
        {  
            //Add the pnlToolTipContainer panel to the updatepanel, and make the test informationlabel visibility to true     
            panel.ContentTemplateContainer.Controls.Add(pnlToolTipContainer);  
            lblInfo.Visible = true;  
            lblInfo.Text = elementID;  
 
            toolTipProviderID.Text = elementID; // puts the current row's providerID in textbox to bind aliasGrid to that providerID       
            aliasGrid.Rebind();  
 
        } 


<telerik:RadScriptManager ID="RadScriptManager1" Runat="server">  
    </telerik:RadScriptManager> 
    <div> 
      
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">  
            <AjaxSettings> 
                <telerik:AjaxSetting AjaxControlID="okButton">  
                    <UpdatedControls> 
                        <telerik:AjaxUpdatedControl ControlID="okButton" /> 
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" /> 
                    </UpdatedControls> 
                </telerik:AjaxSetting> 
                <telerik:AjaxSetting AjaxControlID="RadGrid1">  
                    <UpdatedControls> 
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" /> 
                    </UpdatedControls> 
                </telerik:AjaxSetting> 
            </AjaxSettings> 
        </telerik:RadAjaxManager> 
      
    </div>   
    <telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="True" AllowPaging="True"    
        DataSourceID="SqlDataSource1" GridLines="None" PageSize="20" OnItemDataBound="RadGrid1_ItemDataBound" > 
         <GroupingSettings CaseSensitive="false" /> 
      <MasterTableView AutoGenerateColumns="False" DataKeyNames="provider_id"    
            DataSourceID="SqlDataSource1" AllowSorting="True" PageSize="12"   
             InsertItemPageIndexAction="ShowItemOnCurrentPage">  
        <SortExpressions> 
          <telerik:GridSortExpression FieldName="provider_name" SortOrder="Ascending" /> 
        </SortExpressions> 
<RowIndicatorColumn> 
<HeaderStyle Width="20px"></HeaderStyle> 
</RowIndicatorColumn> 
 
<ExpandCollapseColumn> 
<HeaderStyle Width="20px"></HeaderStyle> 
</ExpandCollapseColumn> 
        <Columns> 
          <telerik:GridBoundColumn DataField="provider_id" DataType="System.Int32"    
              ReadOnly="True" SortExpression="provider_id"  display="false" 
              UniqueName="provider_id">  
          </telerik:GridBoundColumn> 
          <telerik:GridBoundColumn DataField="provider_name" HeaderText="Provider Name"   
            SortExpression="provider_name" UniqueName="provider_name">  
          </telerik:GridBoundColumn> 
                     
          <telerik:GridTemplateColumn DataField="provider_alias" HeaderText="Primary Provider Alias" SortExpression="provider_alias" 
                                    UniqueName="provider_alias">  
                                    <ItemTemplate>&nbsp;  
                                        <asp:Label ID="Label1" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.provider_alias") %>'>  
                                        </asp:Label> 
                                    </ItemTemplate> 
                                </telerik:GridTemplateColumn> 
          <telerik:GridBoundColumn DataField="provider_alias" HeaderText="Primary Provider Alias"   
            SortExpression="provider_alias" UniqueName="provider_alias"   
                AllowFiltering="false">  
          </telerik:GridBoundColumn> 
    </Columns> 
          <PagerStyle Mode="NextPrevAndNumeric" /> 
          <HeaderStyle Font-Bold="False" Font-Italic="False" Font-Overline="False"   
              Font-Strikeout="False" Font-Underline="False" VerticalAlign="Bottom"   
              Wrap="True" /> 
</MasterTableView> 
 
       <ClientSettings> 
         <ClientEvents  OnRowSelected="rowSelected" /> 
         <Selecting AllowRowSelect="True" /> 
        </ClientSettings> 
 
<FilterMenu EnableTheming="True">  
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
</FilterMenu> 
    </telerik:RadGrid> 
    
 
 <asp:Panel ID="pnlToolTipContainer" runat="server">     
             
      <asp:Label ID="lblInfo" runat="server" Visible="false" ></asp:Label>    
      <br />    
    <telerik:RadGrid ID="aliasGrid" runat="server" GridLines="None"        
        DataSourceID="ccAlias" AutoGenerateColumns="False">       
          <MasterTableView NoMasterRecordsText="No aliases to display">       
            <Columns>       
              <telerik:GridBoundColumn DataField="alias_name" HeaderText="All Aliases"></telerik:GridBoundColumn>       
           </Columns>       
        </MasterTableView>       
    </telerik:RadGrid>      
</asp:Panel>     
 
     <telerik:RadToolTipManager runat="server" ID="RadToolTipManager1" Position="Center"   
            RelativeTo="Element" Width="320px" Height="260px" Animation="Resize"   
            HideEvent="LeaveToolTip" Skin="WebBlue" OnAjaxUpdate="OnAjaxUpdate">    
 </telerik:RadToolTipManager>  



Here is some history from the response to the thread I recieved in the email:
From: Laura  
Date: 11/27/2008 4:08:30 PM  
 
I wrote a question to the forum the other day about using a tooltip for a template column and displaying the detail items in a grid in a tooltip for a specific column. What I want to do is this: I have a grid of providers and a template column which is primary provider alias. I have another table called provider_aliases which is all the aliases for each provider. I want to hover over the primary alias and show a tooltip of all provider_aliases. I got a great answer here telling me to use the tooltipmananger and on the ajaxrequest to load the alias grid into the tooltip and tried to implement it and I am 90% there. The forum post is gone and I still need a little help, so I am reposting it by copying parts from the email I recieved when I got the answer. I don't know why I cant access the original post.  
 
Shinu helped me greatly with this answer:  
 
From: Shinu  
Date: 11/26/2008 5:18:38 AM  
 
Hi Laura,  
 
 
I have one suggestion for doing this instead of adding the tooltip inside the template column with the "aliasGrid ",  
 
place the aliasGrid outside the RadGrid1 and use the tooltip manager as explained in the demo  to show the related alias's  on hover the label.  
 
Radgrid1 with Label in the tempplate column.  
 
..........  
 
 

Here is the last reply I got from Shinu:
From: Shinu
Date: 11/28/2008 1:25:42 AM
Hello Laura,

First you need to make sure that the tooltip is coming correctly when hover the link, try the folowing trick to test whether it is appearing correctly.

place the aliasGrid  inside one panel, put one label also to test whether the arg values are coming passing correctly.

I don't this they are being passed correctly. What should I do next?

Thanks,
Laura

2 Answers, 1 is accepted

Sort by
0
Accepted
Iana Tsolova
Telerik team
answered on 01 Dec 2008, 01:59 PM
Hi Laura,

I suggest that you place this pnlToolTipContainer into a user control. Then you can load this user control in the tool tip on AjaxUpdate.

Give it a try and let me know if this works for you.

Greetings,
Iana
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Laura
Top achievements
Rank 1
answered on 01 Dec 2008, 02:35 PM
Thank you...I got it to work using the user control and also your help in the support ticket that I submitted.
Tags
Grid
Asked by
Laura
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Laura
Top achievements
Rank 1
Share this question
or