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

multiple RadToolTipManager in Radgrid

3 Answers 222 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
Oliver
Top achievements
Rank 1
Oliver asked on 26 Aug 2009, 11:39 AM
Hi ... following problem: I have a grid, in which I want display 2 different tooltips (ascx-pages)... to realize this, I must rebind the grid after closing. if not, the tooltip always shows the first loaded ascx-page. is there a solution for this issue?

Here my code:
<%@ Page
    Language="C#"
    AutoEventWireup="true"
    CodeBehind="AssetEdit_Messaging.aspx.cs"
    Inherits="Sigma_Web.AssetEdit_Messaging" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Messagingcenter</title>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="ScriptManager1" runat="server"
        EnableTheming="True">
    </telerik:RadScriptManager>
    <telerik:RadStyleSheetManager ID="RadStyleSheetManager1" runat="server"></telerik:RadStyleSheetManager>
    
    <div
        style="
        vertical-align: middle;
        line-height: 34px;
        background-color: #BBD7FA;
        color: gray;
        font-weight: bold;
        font-size: 15pt;
        height: 34px;
        background-color: #BBD7FA;">
        <div style="float: left; vertical-align: middle">
            <asp:Image
                ID="IMG_HeaderRight" runat="server"
                AlternateText="L_AssetEdit_MSCImage" />
        </div>
        <div style="float: left; padding-left: 10px;">
            <asp:Label
                ID="Label2" runat="server"                 
                Text="L_AssetEdit_MSCMessagingCenter">
            </asp:Label>
        </div>
        <div style="float: right; padding-top: 6px;">
                <telerik:RadComboBox
                    ID="RadComboBox1" runat="server"
                    AutoPostBack="true"
                    Height="150px"
                    OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged" DataTextFormatString="<nobr>{0}</nobr">
                    <Items>
                        <telerik:RadComboBoxItem Text="L_AssetEdit_MSC10seconds" Value="10000" />
                        <telerik:RadComboBoxItem Text="L_AssetEdit_MSC30seconds" Value="30000"/>
                        <telerik:RadComboBoxItem Text="L_AssetEdit_MSC60seconds" Value="60000" Selected="True" />
                        <telerik:RadComboBoxItem Text="L_AssetEdit_MSC120seconds" Value="1200000"/>
                        <telerik:RadComboBoxItem Text="L_AssetEdit_MSC240seconds" Value="2400000"/>
                        <telerik:RadComboBoxItem Text="L_AssetEdit_MSC0seconds" Value="0"/>
                    </Items>
                </telerik:RadComboBox>
            </div>
        <div style="float: right; padding-right: 10px;">
            <asp:Label
                ID="Label3" runat="server"
                Text="L_AssetEdit_MSCChangeTimerInterval"></asp:Label>
        </div>
    </div>
    
    <telerik:RadTabStrip
        ID="RadTabStrip1" runat="server"
        MultiPageID="RadMultiPage1"
        SelectedIndex="3"
        Skin="Office2007">
        <Tabs>
            <telerik:RadTab runat="server" PageViewID="PageView1" Text="L_AssetEdit_MSCComputer" Selected="True" />
            <telerik:RadTab runat="server" PageViewID="PageView2" Text="L_AssetEdit_MSCProducts" />
        </Tabs>
    </telerik:RadTabStrip>        
    
    <telerik:RadMultiPage
            ID="RadMultiPage1" runat="server"
            SelectedIndex="0">
            
    <telerik:RadPageView ID="PageView1" runat="server">        
        <telerik:RadGrid
            ID="RadGrid1" runat="server"
            GridLines="None"
            DataSourceID="SDS_MCComputer"
            AllowPaging="True"
            AllowSorting="True"
            AutoGenerateColumns="False" onitemdatabound="RadGrid1_ItemDataBound"
            onitemcommand="RadGrid1_ItemCommand" >
            <MasterTableView
                DataSourceID="SDS_MCComputer"
                AutoGenerateColumns="False"
                TableLayout="Fixed"
                DataKeyNames="Id, ComputerId, ProductId"
                PageSize="20">
                <GroupByExpressions>
                    <telerik:GridGroupByExpression>
                        <SelectFields>
                            <telerik:GridGroupByField
                                FieldAlias="Computername"
                                FieldName="ComputerName"
                                HeaderValueSeparator=": ">
                            </telerik:GridGroupByField>                            
                        </SelectFields>
                        <GroupByFields>                            
                            <telerik:GridGroupByField
                                FieldAlias="ComputerName"
                                FieldName="ComputerName"
                                HeaderValueSeparator=": "/>                            
                        </GroupByFields>
                    </telerik:GridGroupByExpression>                                
                </GroupByExpressions>
                <Columns>
                    <telerik:GridTemplateColumn                                 
                        ReadOnly="True" >
                        <ItemTemplate>
                            <asp:ImageButton
                                ID="IB_Tasks_More" runat="server"
                                ImageUrl="Img/16x16/shadow/information.png" />                                    
                        </ItemTemplate>
                        <HeaderStyle Width="5px"></HeaderStyle>
                    </telerik:GridTemplateColumn>
                    <telerik:GridBoundColumn
                        DataField="ComputerName"
                        HeaderText="L_AssetEdit_MSCComputerName"
                        SortExpression="ComputerName"
                        UniqueName="ComputerName"
                        DataFormatString="<nobr>{0}</nobr>">
                        <HeaderStyle Width="25px"></HeaderStyle>
                    </telerik:GridBoundColumn>                    
                    <telerik:GridTemplateColumn
                        HeaderText="L_AssetEdit_MSCProductName"
                        ReadOnly="True"
                        SortExpression="Product_InstName">
                        <ItemTemplate>
                            <asp:ImageButton
                                ID="IB_ProductStatus" runat="server"
                                ImageUrl="Img/16x16/shadow/information.png" />
                            <asp:Label
                                ID="LBL_ProductStatus" runat="server"
                                Text='<%# Eval("Product_InstName") %>'>
                            </asp:Label>
                        </ItemTemplate>
                        <HeaderStyle Width="25px"></HeaderStyle>
                    </telerik:GridTemplateColumn>
                    <telerik:GridBoundColumn
                        DataField="Status_Text"
                        HeaderText="L_AssetEdit_MSCStatus_Text"
                        SortExpression="Status_Text"
                        UniqueName="Status_Text"
                        DataFormatString="<nobr>{0}</nobr>">
                        <HeaderStyle Width="25px"></HeaderStyle>
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn
                        DataField="Type_Text"
                        HeaderText="L_AssetEdit_MSCType_Text"
                        SortExpression="Type_Text"
                        UniqueName="Type_Text"
                        DataFormatString="<nobr>{0}</nobr>">
                        <HeaderStyle Width="60px"></HeaderStyle>
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn
                        DataField="Task_Name"
                        HeaderText="L_AssetEdit_MSCTask_Name"
                        SortExpression="Task_Name"
                        UniqueName="Task_Name"
                        DataFormatString="<nobr>{0}</nobr>">
                        <HeaderStyle Width="60px"></HeaderStyle>
                    </telerik:GridBoundColumn>                    
                    <telerik:GridBoundColumn
                        DataField="TimeStart"
                        DataType="System.DateTime"
                        HeaderText="L_AssetEdit_MSCTimeStart"
                        SortExpression="TimeStart"
                        UniqueName="TimeStart"
                        DataFormatString="<nobr>{0}</nobr>">
                        <HeaderStyle Width="40px"></HeaderStyle>
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn
                        DataField="TimeStop"
                        DataType="System.DateTime"
                        HeaderText="L_AssetEdit_MSCTimeStop"
                        SortExpression="TimeStop"
                        UniqueName="TimeStop"
                        DataFormatString="<nobr>{0}</nobr>">
                        <HeaderStyle Width="40px"></HeaderStyle>
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn
                        DataField="ReturnCode_Text"
                        HeaderText="L_AssetEdit_MSCReturnCode_Text"
                        SortExpression="ReturnCode_Text"
                        UniqueName="ReturnCode_Text"
                        DataFormatString="<nobr>{0}</nobr>">
                        <HeaderStyle Width="25px"></HeaderStyle>
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn
                        DataField="Message"
                        HeaderText="L_AssetEdit_MSCMessage"
                        SortExpression="Message"
                        UniqueName="Message"
                        DataFormatString="<nobr>{0}</nobr>">
                        <HeaderStyle Width="150px"></HeaderStyle>
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn
                        DataField="Timeout"
                        DataType="System.Int32"
                        HeaderText="L_AssetEdit_MSCTimeout"
                        SortExpression="Timeout"
                        UniqueName="Timeout"
                        DataFormatString="<nobr>{0}</nobr>">
                        <HeaderStyle Width="15px"></HeaderStyle>
                    </telerik:GridBoundColumn>
                </Columns>
            </MasterTableView>
            <ClientSettings AllowDragToGroup="True">
            </ClientSettings>
        </telerik:RadGrid>           
    </telerik:RadPageView>
    
    <telerik:RadPageView ID="RadPageView1" runat="server" Width="100%">
        <telerik:RadGrid
            ID="RadGrid2" runat="server"
            GridLines="None"
            DataSourceID="SDS_MCProducts"
            AllowFilteringByColumn="False"
            AllowPaging="True"
            AllowSorting="True"
            AutoGenerateColumns="False" onitemdatabound="RadGrid2_ItemDataBound"
            onitemcommand="RadGrid2_ItemCommand" >
            <MasterTableView
                DataSourceID="SDS_MCProducts"
                AutoGenerateColumns="False"
                TableLayout="Fixed"
                DataKeyNames="InstallationTaskId,ConfigurationTaskId"
                PageSize="20">
                <GroupByExpressions>
                    <telerik:GridGroupByExpression>
                        <SelectFields>
                            <telerik:GridGroupByField
                                FieldAlias="Productname"
                                FieldName="Products_Name"
                                HeaderValueSeparator=": ">
                            </telerik:GridGroupByField>                            
                        </SelectFields>
                        <GroupByFields>                            
                            <telerik:GridGroupByField
                                FieldAlias="Productname"
                                FieldName="Products_Name"
                                HeaderValueSeparator=": "/>                            
                        </GroupByFields>
                    </telerik:GridGroupByExpression>                                
                </GroupByExpressions>
                <Columns>                                     
                    <telerik:GridBoundColumn
                        DataField="Products_Name"
                        HeaderText="L_AssetEdit_MSCProductName"
                        SortExpression="Products_Name"
                        UniqueName="Products_Name"
                        DataFormatString="<nobr>{0}</nobr>">
                        <HeaderStyle Width="25px"></HeaderStyle>
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn
                        DataField="Status_Text"
                        HeaderText="L_AssetEdit_MSCStatus_Text"
                        SortExpression="Status_Text"
                        UniqueName="Status_Text"
                        DataFormatString="<nobr>{0}</nobr>">
                        <HeaderStyle Width="25px"></HeaderStyle>
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn
                        DataField="ProductVersion"
                        HeaderText="L_AssetEdit_MSCProductVersion"
                        SortExpression="ProductVersion"
                        UniqueName="ProductVersion"
                        DataFormatString="<nobr>{0}</nobr>">
                        <HeaderStyle Width="25px"></HeaderStyle>
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn
                        DataField="Products_Description"
                        HeaderText="L_AssetEdit_MSCProductDescription"
                        SortExpression="Products_Description"
                        UniqueName="Products_Description"
                        DataFormatString="<nobr>{0}</nobr>">
                        <HeaderStyle Width="75px"></HeaderStyle>
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn
                        DataField="ComputerName"
                        HeaderText="L_AssetEdit_MSCComputerName"
                        SortExpression="ComputerName"
                        UniqueName="ComputerName"
                        DataFormatString="<nobr>{0}</nobr>">
                        <HeaderStyle Width="25px"></HeaderStyle>
                    </telerik:GridBoundColumn>                    
                    <telerik:GridBoundColumn
                        DataField="TimeAssigned"
                        DataType="System.DateTime"
                        HeaderText="L_AssetEdit_MSCTimeAssigned"
                        SortExpression="TimeAssigned"
                        UniqueName="TimeAssigned"
                        DataFormatString="<nobr>{0}</nobr>">
                        <HeaderStyle Width="40px"></HeaderStyle>
                    </telerik:GridBoundColumn>                    
                    <telerik:GridTemplateColumn
                        HeaderText="L_AssetEdit_MSCInstStat"
                        ReadOnly="True"
                        SortExpression="InstallationStatus_Text">
                        <ItemTemplate>
                            <asp:ImageButton
                                ID="IB_InstallationStatus" runat="server"
                                ImageUrl="Img/16x16/shadow/information.png" />
                            <asp:Label
                                ID="LBL_InstallationStatus" runat="server"
                                Text='<%# Eval("InstallationStatus_Text") %>'>
                            </asp:Label>
                        </ItemTemplate>
                        <HeaderStyle Width="25px"></HeaderStyle>
                    </telerik:GridTemplateColumn>
                    <telerik:GridBoundColumn
                        DataFormatString="<nobr>{0}</nobr>"
                        DataField="InstallationTime"                                 
                        HeaderText="L_AssetEdit_MSCInstTime"
                        ReadOnly="True"
                        SortExpression="InstallationTime"
                        UniqueName="InstallationTime"
                        DataType="System.DateTime" >
                        <HeaderStyle Width="40px"></HeaderStyle>
                    </telerik:GridBoundColumn>
                    <telerik:GridTemplateColumn
                        HeaderText="L_AssetEdit_MSCConfStat"
                        ReadOnly="True"
                        SortExpression="ConfigurationStatus_Text">
                        <ItemTemplate>
                            <asp:ImageButton
                                ID="IB_ConfigurationStatus" runat="server"
                                ImageUrl="Img/16x16/shadow/information.png" />
                            <asp:Label
                                ID="LBL_ConfigurationStatus" runat="server"
                                Text='<%# Eval("ConfigurationStatus_Text") %>'>
                            </asp:Label>
                        </ItemTemplate>
                        <HeaderStyle Width="25px"></HeaderStyle>
                    </telerik:GridTemplateColumn>
                    <telerik:GridBoundColumn
                        DataFormatString="<nobr>{0}</nobr>"
                        DataField="ConfigurationTime"                                 
                        HeaderText="L_AssetEdit_MSCConfTime"
                        ReadOnly="True"
                        SortExpression="ConfigurationTime"
                        UniqueName="ConfigurationTime"
                        DataType="System.DateTime" >
                        <HeaderStyle Width="40px"></HeaderStyle>
                    </telerik:GridBoundColumn>                    
                </Columns>
            </MasterTableView>
            <ClientSettings AllowDragToGroup="True">
            </ClientSettings>
        </telerik:RadGrid>           
    </telerik:RadPageView>
        
    
    </telerik:RadMultiPage>            
    <telerik:RadAjaxManager runat="server" ID="AjaxManager1"
        onajaxrequest="AjaxManager1_AjaxRequest">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadComboBox1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadComboBox1" />
                    <telerik:AjaxUpdatedControl ControlID="Panel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="Timer1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1"
                        LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    
    <telerik:RadAjaxLoadingPanel
        ID="RadAjaxLoadingPanel1" Runat="server"
        height="75px" Transparency="20" width="75px" InitialDelayTime="1000">
        <table style="width:100%; height:100%;">
            <tr style="height:100%">
                <td align="center" valign="middle" style="width:100%">
                    <img alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>'
                    style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" />
                </td>
            </tr>
        </table>
    </telerik:RadAjaxLoadingPanel>

    
    <asp:Panel ID="Panel1" runat="server">
        <asp:Timer
            ID="Timer1" runat="server"
            Interval="60000"
            OnTick="Timer1_Tick" />
    </asp:Panel>
    
    <asp:SqlDataSource ID="SDS_MCComputer" runat="server"
        ConnectionString="<%$ ConnectionStrings:SigmaConnectionString %>"
        SelectCommand="WI_Asset_Edit" SelectCommandType="StoredProcedure">
        <SelectParameters>
            <asp:Parameter DefaultValue="GET_MCComputer" Name="Todo" Type="String" />                        
            <asp:QueryStringParameter DefaultValue="0" Name="OrgUnitId" QueryStringField="OrgUnitId" />
            <asp:QueryStringParameter Name="CStat" QueryStringField="CStat" Type="String" />
        </SelectParameters>
    </asp:SqlDataSource>
    
    <asp:SqlDataSource ID="SDS_MCProducts" runat="server"
        ConnectionString="<%$ ConnectionStrings:SigmaConnectionString %>"
        SelectCommand="WI_Asset_Edit" SelectCommandType="StoredProcedure">
        <SelectParameters>
            <asp:Parameter DefaultValue="GET_MCProducts" Name="Todo" Type="String" />                        
            <asp:QueryStringParameter DefaultValue="0" Name="OrgUnitId" QueryStringField="OrgUnitId" />
            <asp:QueryStringParameter Name="PStat" QueryStringField="PStat" Type="String" />
        </SelectParameters>
    </asp:SqlDataSource>
    
    <telerik:RadFormDecorator ID="RadFormDecorator1" Runat="server"
        Skin="Office2007" />
    
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
            window.moveTo(0, 0);
            window.resizeTo(screen.width, screen.height);

            function refreshGrids(Eventstring) {
                $find("<%= AjaxManager1.ClientID %>").ajaxRequest(Eventstring);
            }

            function OnClientBeforeShow(sender, args) {
                sender.set_modal(sender.get_modal());
            };  
        </script>                    
    </telerik:RadCodeBlock>
    
    <telerik:RadToolTipManager
        ID="RadToolTipManager1" runat="server"
        OffsetY="-1"
        Width="500px"
        Height="300px"
        OnAjaxUpdate="RadToolTipManager1_AjaxUpdate"
        RelativeTo="Element"
        Position="BottomLeft"
        Skin="Office2007"
        Modal="True"
        onclientbeforehide="refreshGrids"
        ManualClose="True"
        Title="Computer" OnClientBeforeShow="OnClientBeforeShow">
    </telerik:RadToolTipManager>
    
    <telerik:RadToolTipManager
        ID="RadToolTipManager2" runat="server"
        OffsetY="-1"
        Width="500px"
        Height="200px"
        OnAjaxUpdate="RadToolTipManager2_AjaxUpdate"
        RelativeTo="Element"
        Position="BottomLeft"
        Skin="Office2007"
        Modal="True"
        onclientbeforehide="refreshGrids"
        ManualClose="True"
        Title="Products" OnClientBeforeShow="OnClientBeforeShow">
    </telerik:RadToolTipManager>
    </form>
</body>
</html>

and the c# code:
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

using Telerik.Web.UI;
using System.IO;

namespace Sigma_Web
{
    public partial class AssetEdit_Messaging : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                SqlUtil.AutofillLanguage(Controls);                
            }
        }

        protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (Convert.ToInt32(RadComboBox1.SelectedValue) != 0)
            {
                Timer1.Interval = int.Parse(RadComboBox1.SelectedValue);
            }
            else
            {
                Timer1.Enabled = false;
            }
        }

        protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
        {
            // IB_ProductStatus
            if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem)
            {
                Control target1 = e.Item.FindControl("IB_Tasks_More");
                Control target2 = e.Item.FindControl("IB_ProductStatus");

                if (!Object.Equals(this.RadToolTipManager1, null))
                {
                    if (!Object.Equals(target1, null))
                    {
                        //Add the button (target) id to the tooltip manager
                        this.RadToolTipManager1.TargetControls.Add(target1.ClientID, "Computer;" + (e.Item as GridDataItem).GetDataKeyValue("Id").ToString(), true);
                    }
                
                    if (!Object.Equals(target2, null))
                    {
                        //Add the button (target) id to the tooltip manager
                        this.RadToolTipManager2.TargetControls.Add(target2.ClientID, "Product;" + (e.Item as GridDataItem).GetDataKeyValue("ComputerId").ToString() + ";" + (e.Item as GridDataItem).GetDataKeyValue("ProductId").ToString(), true);
                    }
                }
            }
        }

        protected void RadGrid2_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem)
            {
                Control target1 = e.Item.FindControl("IB_InstallationStatus");
                Control target2 = e.Item.FindControl("IB_ConfigurationStatus");
                if (!Object.Equals(this.RadToolTipManager1, null))
                {
                    if (!Object.Equals(target1, null))
                    {
                        //Add the button (target) id to the tooltip manager
                        this.RadToolTipManager1.TargetControls.Add(target1.ClientID, "Computer;" + (e.Item as GridDataItem).GetDataKeyValue("InstallationTaskId").ToString(), true);
                    }
                    if (!Object.Equals(target2, null))
                    {
                        //Add the button (target) id to the tooltip manager
                        this.RadToolTipManager1.TargetControls.Add(target2.ClientID, "Computer;" + (e.Item as GridDataItem).GetDataKeyValue("ConfigurationTaskId").ToString(), true);
                    }
                }
            }
        }

        protected void RadToolTipManager1_AjaxUpdate(object sender, ToolTipUpdateEventArgs e)
        {          
            this.UpdateToolTip1(e.Value, e.UpdatePanel);
        }
        protected void RadToolTipManager2_AjaxUpdate(object sender, ToolTipUpdateEventArgs e)
        {
            this.UpdateToolTip2(e.Value, e.UpdatePanel);
        }

        private void UpdateToolTip1(string elementID, UpdatePanel panel)
        {
            Control ctrl1 = Page.LoadControl("AssetEdit_ToolTipComputer_Tasks.ascx");
            Control ctrl2 = Page.LoadControl("AssetEdit_ToolTipComputer_Products.ascx");

            string[] elements = elementID.Split(';');

            panel.ContentTemplateContainer.Controls.Add(ctrl1);
            Tasks details = (Tasks)ctrl1;
            details.TaskId = elements[1];

        }

        private void UpdateToolTip2(string elementID, UpdatePanel panel)
        {
            Control ctrl1 = Page.LoadControl("AssetEdit_ToolTipComputer_Tasks.ascx");
            Control ctrl2 = Page.LoadControl("AssetEdit_ToolTipComputer_Products.ascx");

            string[] elements = elementID.Split(';');

            panel.ContentTemplateContainer.Controls.Add(ctrl2);
            Products details = (Products)ctrl2;
            details.ComputerId = elements[1];
            details.ProductId = elements[2];

        }

        public void Timer1_Tick(object sender, EventArgs e)
        {
            RadGrid1.Rebind();
            RadGrid2.Rebind();
        }

        protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)
        {
            if (e.CommandName == "Sort" || e.CommandName == "Page")
            {
                RadToolTipManager1.TargetControls.Clear();
                RadToolTipManager2.TargetControls.Clear();
            }
        }

        protected void RadGrid2_ItemCommand(object source, GridCommandEventArgs e)
        {
            if (e.CommandName == "Sort" || e.CommandName == "Page")
            {
                RadToolTipManager1.TargetControls.Clear();
                RadToolTipManager2.TargetControls.Clear();
            }
        }

        protected void AjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
        {
            RadToolTipManager1.TargetControls.Clear();
            RadToolTipManager2.TargetControls.Clear();
            RadGrid1.Rebind();
            RadGrid2.Rebind();
        }
    }
}

Thanks for your help!!!



3 Answers, 1 is accepted

Sort by
0
Svetlina Anati
Telerik team
answered on 31 Aug 2009, 10:15 AM
Hi Oliver,

I am not sure why you need to rebind a grid to show the second user control and why otherwise you get the first one. That is why I prepared a sample demo which loads different controls as you explain and everything works as expected. Please, examine the demo and modify it in order to reproduce the problem. If the modifications are little, you can provide me instructions here,. Otherwise, please open a new support ticket and send me a fully runnable reproduction demo along with detailed explanations and I will do my best to help.


Greetings,
Svetlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Oliver
Top achievements
Rank 1
answered on 01 Sep 2009, 02:04 PM
Thanks for your help ... I found out, that I have to set the datasource to null in the ascx-pages like this:

ProductsView.DataSource =

null;

 

 

this.SDS_ComputerProducts.SelectParameters["ComputerId"].DefaultValue = this.ComputerId;

 

 

this.SDS_ComputerProducts.SelectParameters["ProductId"].DefaultValue = this.ProductId;

 

 

this.SDS_ComputerProducts.DataBind();
...

now it works!!!

 

0
Enigma
Top achievements
Rank 1
answered on 06 Oct 2010, 01:05 AM
I had exactly the same issue however I was using System.Web.UI.Controls for my 2 tooltips. I found the solution was to make sure that each of the child controls added to each of my custom controls had there ID property set in CreateChildControls and there was no common ID value used in both controls.
Tags
ToolTip
Asked by
Oliver
Top achievements
Rank 1
Answers by
Svetlina Anati
Telerik team
Oliver
Top achievements
Rank 1
Enigma
Top achievements
Rank 1
Share this question
or