ToolTip (not manager) and Ajax, Post 2 of 2 - Templated Controls

2 posts, 0 answers
  1. fglrxandyou
    fglrxandyou avatar
    9 posts
    Member since:
    Jun 2007

    Posted 10 Jul 2007 Link to this post

    The following example involves the PanelBar from the previous generation RadControls.

    First, on the ASPX...

    <radA:RadAjaxManager ID="oldAjaxManager" runat="Server" UseEmbeddedScripts="true" EnableOutsideScripts="true"
        <AjaxSettings> 
             
        </AjaxSettings> 
    </radA:RadAjaxManager> 
     
    <radP:RadPanelbar ID="panelbar" runat="server">          
        <ItemTemplate>           
            <telerik:RadToolTip ID="tooltip" Visible="true" runat="Server">                  
                <asp:Panel ID="tooltipPanel" runat="Server"  BackColor="azure">                      
                    <asp:Button ID="testButton" runat="server" Text="postback" />                
                </asp:Panel>             
            </telerik:RadToolTip>        
        </ItemTemplate>          
        <Items>              
            <radP:RadPanelItem Text="item1"  OnInit="panelItem_OnInit" Value="item1" runat="Server">             
            </radP:RadPanelItem>         
        </Items>     
    </radP:RadPanelbar>  

    Now server side..

    protected void selectedLocationsPanelItem_OnInit(object sender, EventArgs args) 
        Telerik.WebControls.RadPanelItem item = sender as Telerik.WebControls.RadPanelItem; 
        Telerik.Web.UI.RadToolTip tooltip = item.FindControl("tooltip") as Telerik.Web.UI.RadToolTip; 
     
        if (tooltip != null) 
        { 
            tooltip.TargetControlID = item.UniqueID; 
            oldAjaxManager.AjaxSettings.Add(ToolTipAjaxSetting(tooltip)); 
        } 
    protected Telerik.WebControls.AjaxSetting ToolTipAjaxSetting(Telerik.Web.UI.RadToolTip tooltip) 
        Telerik.WebControls.AjaxSetting setting = new Telerik.WebControls.AjaxSetting(); 
        Button button = tooltip.FindControl("testButton") as Button; 
        Telerik.WebControls.RadPanelItem item = tooltip.Parent as Telerik.WebControls.RadPanelItem; 
     
        Telerik.WebControls.AjaxUpdatedControl updatedToolTip = new Telerik.WebControls.AjaxUpdatedControl(); 
        Telerik.WebControls.AjaxUpdatedControl updatedPanelbar = new Telerik.WebControls.AjaxUpdatedControl(); 
        Telerik.WebControls.AjaxUpdatedControl updatedItem = new Telerik.WebControls.AjaxUpdatedControl(); 
         
         
     
        updatedToolTip.ControlID = tooltip.UniqueID; 
        updatedPanelbar.ControlID = selectedLocationsPanelbar.UniqueID; 
        updatedItem.ControlID = item.UniqueID; 
     
     
        setting.AjaxControlID = button.UniqueID; 
     
        //Note these three Lines. 
        setting.UpdatedControls.Add(updatedToolTip); 
        setting.UpdatedControls.Add(updatedPanelbar); 
        setting.UpdatedControls.Add(updatedItem); 
     
        return setting; 



    Note the three lines that define which controls are updated.  Change those to play around with the configuration.  When it is uncommented in a scenario i will call it 'Active'


    Scenario I:
    updatedItem active, rest deactive.  On ajax update, the tooptip no longer is attached.

    Scenario II
    UpdatedItem, UpdatedTooltip active.  Same problem.

    Scenario III
    UpdatedPanelbar active, no matter what else is active, on second postback, there is a server error-- "Invalid JSON primitive ."




    I have not attempted this with the other Ajax Controls, due to my documented experiences in Part 1 , as well as similar but undocumented experience outside of these posts, which suggests it simply won't work.



    I suppose a final alternative might be placing these tooltips outside of the panelbar, but this is an ineloquent and unwanted situation.  I have tested it lightly, and it works.

    Also of note is the that it's annoying but an acceptable limitation that one must update the entire panelbar, as opposed to just a single item...

    I believe that covers everything.  I hope it is obvious why this is a different problem than Part I.

    To summarize

    Part I: Only Old Rad Manager works when attempting to reattach tooltips, and even then, it's something of a hack, as the tooltip (it seems?) should not need to be reattached to the object which has the same name it did originally.

    Part II:  When placing a tooltip in a template of a Panelbar, and attaching that tooltip to the item in which it was generated, it receives the "invalid JSON primitive ." error





  2. Tsvetie
    Admin
    Tsvetie avatar
    1517 posts

    Posted 13 Jul 2007 Link to this post

    Hello fglrxandyou,
    The bug, described in this thread is the same as the one in part1.

    For your convenience, I give you here the answer to part1 of your question as well:

    ------------------------------------------------------------------------------------------------------------------------------------------------------------
    We are aware of this issue and our developers are currently working on it. The fix will be available with the next update of the Prometheus suite that will be about the end of july or the beginning of august. In case you need the fix earlier, please open a new support ticket and we will send you the hotfix as soon as it is ready.
    -----------------------------------------------------------------------------------------------------------------------------------------------------------

    Sincerely yours,
    Tsvetie
    the Telerik team

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