EnableAJAX="true" and RadToolTipManager

6 posts, 0 answers
  1. kamiln
    kamiln avatar
    5 posts
    Member since:
    Mar 2007

    Posted 02 Jul 2007 Link to this post

    Hi I'm using the RadToolTipManager with a radgrid. As soon as any ajax request goes through none of the tooltips seem to appear. I got it to work using the radtooltip however my tooltips are loading user controls that have their own queries. The load time for radgrid then becomes too long. Is it possible to have Enableajax set to true, EnableAJAXScrollPaging and have the RadToolTipManager to work for an Icon on each row of my datagrid?

    protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
            {
                if (e.Item.ItemType == GridItemType.AlternatingItem || e.Item.ItemType == GridItemType.Item)
                {
                    System.Web.UI.WebControls.Image image = (System.Web.UI.WebControls.Image)e.Item.FindControl("smallImage");
                    GridDataItem dataItem = (GridDataItem)e.Item;
                    image.ID = dataItem["TestId"].Text;
                    this.RadToolTipManager1.TargetControls.Add(image.ClientID, true);

      protected void OnAjaxUpdate(object sender, ToolTipUpdateEventArgs args)
            {
                int index = args.TargetControlID.LastIndexOf("_");
                string elementId = args.TargetControlID.Substring(index + 1);

                decimal testId;

                if (decimal.TryParse(elementId, out testId))
                {
                    this.UpdateToolTip(testId, args.UpdatePanel);
                }
            }

            private void UpdateToolTip(decimal testId, UpdatePanel panel)
            {
                Control control = Page.LoadControl("~/Controls/Preview/testPreview.ascx");
                panel.ContentTemplateContainer.Controls.Add(control);
                Mycontrol testtPreview = (Mycontrol)control;
                ((Mycontrol)control).testId = testId;
            }
    Thanks.

  2. Tervel
    Admin
    Tervel avatar
    1337 posts

    Posted 06 Jul 2007 Link to this post

    Hello kamiln,

    We made a slight change to the RadToolTip control, that should help you in this scenario.
    Attached is a trial version of the build.

    However, before you give it a try, we suggest that you download the latest official  Prometheus build (the SP1 released on June 26th), because the RadTooltipManager should work properly as well (and in case you are satisified with the result you will also be able to download the developer's version easily).

    There is one change that you need to make in your code, however.
    For the example to work properly, you will need to turn off RadGrid's internal AJAX (EnableAjax = false), and wrap the grid in a MS AJAX UpdatePanel, e.g.

     
    <asp:UpdatePanel ID="Panel1" runat=server UpdateMode=Conditional>  
    <ContentTemplate> 
     
    <radG:RadGrid EnableAJAX="false" runat="server" >....  
    </radG:RadGrid> 
     
     
    </ContentTemplate> 
    </asp:UpdatePanel> 



    Best wishes,
    Tervel
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. kamiln
    kamiln avatar
    5 posts
    Member since:
    Mar 2007

    Posted 06 Jul 2007 Link to this post

    Thank you for your response. I updated the dll and still the result is the same. If I remove update panel everything works fine however the page does a full postback. Is there a working example you have I could compare with?

        <asp:UpdatePanel ID="Panel1" runat=server UpdateMode=Conditional>  
    <ContentTemplate> 

            <radG:RadGrid ID="RadGrid1" Skin="Office2007" ShowGroupPanel="True" ClientSettings-AllowDragToGroup="true"
                ClientSettings-AllowColumnsReorder="true" runat="server" AllowSorting="True"
                EnableAJAX="false" PageSize="10" AllowPaging="true" Width="98%" ShowStatusBar="true" GridLines="none"
                
                OnNeedDataSource="RadGrid1_NeedDataSource"
                OnItemCommand="RadGridItemCommand"
                OnUpdateCommand="RadGrid1UpdateCommand"
                OnDeleteCommand="RadGrid1DeleteCommand"
                OnItemDataBound="RadGrid1_ItemDataBound"
                
                OnEditCommand="RadGrid1_EditCommand"
                OnItemCreated="RadGrid1_ItemCreated"
                AllowMultiRowSelection="True"
                AllowMultiRowEdit="true"
                PagerStyle-AlwaysVisible="true"
                AllowCustomPaging="true"
             onpageindexchanged="RadGrid1_PageIndexChanged"
                EnableAJAXLoadingTemplate="true"
                LoadingTemplateTransparency="50">
               <PagerStyle Mode="NextPrevAndNumeric"></PagerStyle>
              
                <ClientSettings ReorderColumnsOnClient="True" AllowDragToGroup="True" AllowColumnsReorder="True">
                    <Resizing AllowRowResize="True" AllowColumnResize="True"></Resizing>
                    <Selecting AllowRowSelect="true" />
                    <ClientEvents OnRowContextMenu="RowContextMenu" OnGridCreated="GridCreated" OnRowSelected="RowSelected" OnRowDblClick="RowDblClick"></ClientEvents>
                    <Scrolling AllowScroll="True" EnableAJAXScrollPaging="True" UseStaticHeaders="True"></Scrolling>
                </ClientSettings>
             
                <MasterTableView EditMode="inPlace" DataKeyNames="InvoiceId" Width="98%" AutoGenerateColumns="false" CommandItemDisplay="Top">
                  

  4. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 09 Jul 2007 Link to this post

    Hello Kamiln,

    We don't have such example, but if you can isolate the problem in a small sample project and send it to us in a new support ticket (you cannot attach files in the forum), we will check it right away. Once we have a better view over your exact scenario, we will do our best to help.


    Greetings,
    Georgi Tunev
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  5. kamiln
    kamiln avatar
    5 posts
    Member since:
    Mar 2007

    Posted 10 Jul 2007 Link to this post

    Hi,

    I believe I've isolated the problem down. On my NeedDataSource event I'm only retrieving the number of records required for the grid's selected page to display. As soon as I removed my take / skip paramaters and in fact query the entire table than the Ajaxtooltipmanager works fine.  I'm dealing with large tables and making these large queries is not an option. Do you have any recommendation how I can resolved this? It seems the agaxtooltipmanager is only aware of the first datagrid page but any page changes thereafter renders it inactive.

    protected void RadGrid1_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
            {
                int skip = RadGrid1.CurrentPageIndex * this.RadGrid1.PageSize;
                int take = skip + this.RadGrid1.PageSize;

                var query = (from i in Invoices)
                if (RadGrid1.VirtualItemCount.Equals(0))
                    RadGrid1.VirtualItemCount = query.Count();

               RadGrid1.DataSource = query.Skip(skip).Take(take);        }

    Thanks.

  6. Tsvetie
    Admin
    Tsvetie avatar
    1517 posts

    Posted 16 Jul 2007 Link to this post

    Hi kamiln,
    I tried to reproduce the problem you describe, but to no avail. We will really need a simple running project that demonstrates this issue in order to help you handle it. Therefore, please prepare one and send it to us in a new support ticket.

    All the best,
    Tsvetie
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top