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

ShowEvent = FromCode

9 Answers 331 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
Paul Corbett
Top achievements
Rank 1
Paul Corbett asked on 17 Jan 2008, 02:23 PM
Hi,

There is no documentation for this eventtype.Can u briefly describe when would u use this?

I do apologize for asking multiple questions in one post but I am having some difficulties with tooltips inside a formview.

I want to show a tooltip when the user enters the control via click or most likely by using the tab key (thus onFocus) should be used. I set the ShowEvent to OnFocus for the comboBox and textbox but the tooltip doesn't appear.

Secondly I would like to keep the tooltip visible while the user has focus on that control.

Thank you,


9 Answers, 1 is accepted

Sort by
0
Tervel
Telerik team
answered on 21 Jan 2008, 09:32 AM
Hi Chris,

The ShowEvent = "FromCode" instructs the tooltip object to not attach any event handlers to the TargetElement, and the tooltip should be shown using client code, such as the show method.

We tested the OnFocus scenario using a regular select / <asp:DropdDownList> object and it worked fine.

In case you are using RadComboBox Prometheus, however, for the ShowEvent = "OnFocus" to work, you need to attach the tooltip to the combo's INPUT element. Here is how to do it:

<

telerik:RadComboBox ID="combo" runat=server>
    <Items>
        
<telerik:RadComboBoxItem Value="Item" Text="Item" />
    </Items>
</
telerik:RadComboBox>

<telerik:radtooltip runat="server" ID="RadToolTip1"
TargetControlID = '<%#this.combo.ClientID + "_Input" %>'
IsClientId=true
ShowEvent="OnFocus"
.../>

Best regards,
Tervel
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Paul Corbett
Top achievements
Rank 1
answered on 21 Jan 2008, 09:40 AM
Hi,

Thank you for ur reply,

That did the trick, two questions still remain.
1. Will this work with a fieldvalidator attached to the combobox?
2. Also the issue with the onFocus event is more prominent with the radinput controls. I am not getting the tooltip to execute at all (inside the formview). Some of the radinput controls have a fieldvalidator as well.

The controls that I am using are "Prometheus".

Thanks
0
Paul Corbett
Top achievements
Rank 1
answered on 21 Jan 2008, 09:45 AM
This thread is the same as the one I opened later (with a better description)
http://www.telerik.com/community/forums/thread/b311D-bbtebg.aspx

So please close that thread.

Thanks
0
Tervel
Telerik team
answered on 21 Jan 2008, 09:52 AM
Hello Chris,

1. The validator and the tooltip have nothing in common and one should not interfere with the other. So, answer here is : yes, it should work fine.

2. The RadInput control, similar to the RadComboBox control, needs to attach the tooltip to its internal INPUT control that has a different ID. Here it is how to do it:

<

telerik:RadTextBox runat=server ID="textbox"></telerik:RadTextBox>

<telerik:radtooltip runat="server" ID="RadToolTip1"
Targetcontrolid = '<%#this.textbox.ClientID + "_text" %>'
IsClientId=true
ShowEvent="OnFocus"
/>

We will be preparing a more extensive topic how to attach the tooltip to Telerik controls with complex rendering and multiple elements.

Regards,
Tervel
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Paul Corbett
Top achievements
Rank 1
answered on 21 Jan 2008, 09:58 AM
Thank you,

looking forward to that extended documentation.

Where will it be posted?

Thanks
0
Paul Corbett
Top achievements
Rank 1
answered on 21 Jan 2008, 10:50 AM
Hi Tervel,

Unfortunately your suggestions didn't work.

I tried running your code and I got the following error
where ddlCoType  is my comboBox within the formView. I think we will need to use a findControl sort of function.

Compiler Error Message:
CS0117: 'ASP.retail_aspx' does not contain a definition for 'ddlCoType'

What does the '<%# control.ClientID %>' do in Javascript. My Javascript is not that strong to understand this line of code. If you could give me some reference that would be great.

Secondly I tried a sample code to see if it works outside the formview.  The only time it worked is on a OnClick even of a comboBox with the TargetID set to "comboBox1" NOT the way you specified. Here is the code

        <telerik:RadTextBox ID="RadTextBox1" runat="server"
        </telerik:RadTextBox> 
        &nbsp;<br /> 
        <telerik:RadComboBox ID="RadComboBox1" runat="server"
            <CollapseAnimation Duration="200" Type="OutQuint" /> 
            <Items> 
                <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem1" /> 
                <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem2" /> 
                <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem3" /> 
            </Items> 
            <ExpandAnimation Type="OutQuart" /> 
        </telerik:RadComboBox> 
        <br /> 
        <telerik:RadComboBox ID="RadComboBox2" runat="server"
            <CollapseAnimation Duration="200" Type="OutQuint" /> 
            <Items> 
                <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem1" /> 
                <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem2" /> 
                <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem3" /> 
                <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem4" /> 
            </Items> 
            <ExpandAnimation Type="OutQuart" /> 
        </telerik:RadComboBox> 
        <telerik:RadToolTip ID="RadToolTip1" runat="server" TargetControlID='<%# this.RadComboBox1.ClientID + "_Input" %>' Text="MyTooltip" 
        RelativeTo="Element" ShowEvent="OnFocus" Position="BottomRight" IsClientID="true" > 
        </telerik:RadToolTip> 
        <telerik:RadToolTip ID="RadToolTip2" runat="server" TargetControlID="RadComboBox2" IsClientID="true" ShowEvent="OnClick" 
         Text="Tooltip for Combo 2" Position="BottomRight"
        </telerik:RadToolTip> 
        <telerik:RadToolTip ID="RadToolTip3" runat="server" TargetControlID='<%# this.RadTextBox1.ClientID + "_text" %>' IsClientID="true" ShowEvent="OnClick" 
        Text="Tooltip for Textbox" Position="BottomRight"
        </telerik:RadToolTip> 
 

Thanks
0
Tsvetie
Telerik team
answered on 23 Jan 2008, 09:28 AM
Hi Chris Lekkas,
Generally, one thing we missed to mention in the previous post is that when you use DataBinding expressions (<%#   %>) to set the TargetControlID, you have to call DataBind method for the RadToolTip. However, in your case, as you mention that the RadToolTips are inside a FormView, you need not do this.

Please note that the DataBinding expressions are not javascript code ('<%# control.ClientID %>') and the code between the tags is actually executed on the server, before the HTML is sent to the browser. That is why, indeed you will need to use the FindControl method:

<asp:FormView ID="FormView1" runat="server" DataSourceID="AccessDataSource1">  
    <ItemTemplate> 
        ProductID:  
        <asp:Label ID="ProductIDLabel" runat="server" Text='<%# Eval("ProductID") %>'></asp:Label><br /> 
        <telerik:RadTextBox ID="RadTextBox1" runat="server">  
        </telerik:RadTextBox> 
        <br /> 
        <telerik:RadComboBox ID="RadComboBox1" runat="server">  
            <CollapseAnimation Duration="200" Type="OutQuint" /> 
            <Items> 
                <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem1" /> 
                <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem2" /> 
                <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem3" /> 
            </Items> 
            <ExpandAnimation Type="OutQuart" /> 
        </telerik:RadComboBox> 
        <br /> 
        <telerik:RadComboBox ID="RadComboBox2" runat="server">  
            <CollapseAnimation Duration="200" Type="OutQuint" /> 
            <Items> 
                <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem1" /> 
                <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem2" /> 
                <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem3" /> 
                <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem4" /> 
            </Items> 
            <ExpandAnimation Type="OutQuart" /> 
        </telerik:RadComboBox> 
        <telerik:RadToolTip ID="RadToolTip1" runat="server"   
            TargetControlID='<%# this.FormView1.FindControl("RadComboBox1").ClientID + "_Input" %>' 
            Text="MyTooltip" RelativeTo="Element" ShowEvent="OnFocus" Position="BottomRight" 
            IsClientID="true">  
        </telerik:RadToolTip> 
        <telerik:RadToolTip ID="RadToolTip2" runat="server" TargetControlID="RadComboBox2" 
            IsClientID="true" ShowEvent="OnClick" Text="Tooltip for Combo 2" Position="BottomRight">  
        </telerik:RadToolTip> 
        <telerik:RadToolTip ID="RadToolTip3" runat="server"   
            TargetControlID='<%# this.FormView1.FindControl("RadTextBox1").ClientID + "_text" %>' 
            IsClientID="true" ShowEvent="OnClick" Text="Tooltip for Textbox" Position="BottomRight">  
        </telerik:RadToolTip> 
    </ItemTemplate> 
</asp:FormView> 
<asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/Nwind.mdb" 
    SelectCommand="SELECT TOP 3 [ProductID], [ProductName], [CategoryName] FROM [Alphabetical List of Products]">  
</asp:AccessDataSource> 


Regards,
Tsvetie
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Paul Corbett
Top achievements
Rank 1
answered on 23 Jan 2008, 11:45 AM
Hi Tsvetie,

Thank you for your code sample but I continue to have problems with making a tooltip work.

When I compile your sample code it works. When I try to create my own page with my own controls and tooltips it fails.

Even a simple example with 3 controls (2 radtextboxes, 1 radcombobox) with a tooltip for each will not appear.

I wonder if there are essential properties I am missing or I need to include extra controls to make it work. I have a RadScriptManager on this page.

For every control I set the targetControlID ='<%# RadTextBox1.ClientID + "_text"%> and I have not been succesful.

Maybe my environment is not setup correctly??

Any help will be greatly appreciated.


0
Accepted
Tsvetie
Telerik team
answered on 25 Jan 2008, 08:21 AM
Hi Chris Lekkas,
No, there are no special properties you need to set - as you yourself point out, my code works without any additional properties. That applies also to your question about the environment - in case my code works, you should not have problems with your code.

In case you prepare and send us a simple project, that we can run without modifications, we will have a look at your code to see what is causing the problem.

Best wishes,
Tsvetie
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
ToolTip
Asked by
Paul Corbett
Top achievements
Rank 1
Answers by
Tervel
Telerik team
Paul Corbett
Top achievements
Rank 1
Tsvetie
Telerik team
Share this question
or