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

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

1 Answer 132 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
fglrxandyou
Top achievements
Rank 1
fglrxandyou asked on 10 Jul 2007, 07:47 PM
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





1 Answer, 1 is accepted

Sort by
0
Tsvetie
Telerik team
answered on 13 Jul 2007, 01:19 PM
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
Tags
ToolTip
Asked by
fglrxandyou
Top achievements
Rank 1
Answers by
Tsvetie
Telerik team
Share this question
or