ShowEvent = FromCode

10 posts, 1 answers
  1. Paul Corbett
    Paul Corbett avatar
    19 posts
    Member since:
    Jan 2008

    Posted 17 Jan 2008 Link to this post

    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,


  2. Tervel
    Admin
    Tervel avatar
    1337 posts

    Posted 21 Jan 2008 Link to this post

    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
  3. Paul Corbett
    Paul Corbett avatar
    19 posts
    Member since:
    Jan 2008

    Posted 21 Jan 2008 Link to this post

    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
  4. Paul Corbett
    Paul Corbett avatar
    19 posts
    Member since:
    Jan 2008

    Posted 21 Jan 2008 Link to this post

    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
  5. Tervel
    Admin
    Tervel avatar
    1337 posts

    Posted 21 Jan 2008 Link to this post

    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
  6. Paul Corbett
    Paul Corbett avatar
    19 posts
    Member since:
    Jan 2008

    Posted 21 Jan 2008 Link to this post

    Thank you,

    looking forward to that extended documentation.

    Where will it be posted?

    Thanks
  7. Paul Corbett
    Paul Corbett avatar
    19 posts
    Member since:
    Jan 2008

    Posted 21 Jan 2008 Link to this post

    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
  8. Tsvetie
    Admin
    Tsvetie avatar
    1517 posts

    Posted 23 Jan 2008 Link to this post

    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
  9. Paul Corbett
    Paul Corbett avatar
    19 posts
    Member since:
    Jan 2008

    Posted 23 Jan 2008 Link to this post

    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.


  10. Answer
    Tsvetie
    Admin
    Tsvetie avatar
    1517 posts

    Posted 25 Jan 2008 Link to this post

    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
Back to Top