RadToolTip

7 posts, 2 answers
  1. El
    El avatar
    130 posts
    Member since:
    Dec 2008

    Posted 01 Nov 2010 Link to this post

    I know how to show/hide the toolbar but on client-side. Now i have a bit different scenario which is the following:

    It is an AJAX button that should check if user exists (SQL Server) and display the result in RadToolTip. I have added the button in the RadAjaxManager's AjaxSettings. Please either show me the right demo or please explain to me how do i handle it by myself.

    Thanks
  2. Cori
    Cori avatar
    562 posts
    Member since:
    Jul 2010

    Posted 01 Nov 2010 Link to this post

    Hello El,

    You can use the RadAjaxManager's ResponseScripts to pass a script to call the RadTooltip using a JavaScript function. Like so:

    Code-behind:

    RadAjaxManager.ResponseScripts.Add("ShowRadTooltip('Response from button')");

    Javascript:

    function ShowRadaTooltip(message)
    {
       var tooltip = $find("<%RadTooltip1.ClientID"%>");
       tooltip.set_text(message);
       tooltip.show();
    }

    You can do either that or you can add the RadTooltip to RadAjaxManager and in the button's click event, you can set the text of the tooltip and set VisibleOnPageLoad to true.

    I hope that helps.
  3. El
    El avatar
    130 posts
    Member since:
    Dec 2008

    Posted 01 Nov 2010 Link to this post

    Ok i did follow the second suggestion which is adding the tooltip to RadAjaxManager and then set the text property from code behind.

    e.g.
    <telerik:AjaxSetting AjaxControlID="DomainAvailabilityButton">
        <UpdatedControls>
            <telerik:AjaxUpdatedControl ControlID="DomainAvailabilityToolTip" />
        </UpdatedControls>
    </telerik:AjaxSetting>
    <telerik:AjaxSetting AjaxControlID="UsernameAvailibilityButton">
        <UpdatedControls>
            <telerik:AjaxUpdatedControl ControlID="UsernameAvailibilityToolTip" />
        </UpdatedControls>
    </telerik:AjaxSetting>

    The Buttons and The ToolTips are well formed and they actually work like a charm but, not entirely.
    <asp:Button ID="DomainAvailabilityButton" runat="server"
        CausesValidation="false" Text="Check availability" />
    <telerik:RadToolTip ID="DomainAvailabilityToolTip" runat="server"
        RelativeTo="Element"
        ShowEvent="FromCode"
        Skin="Sunset"
        TargetControlID="DomainAvailabilityButton"
        AutoCloseDelay="5"
        EnableShadow="true"
        HideEvent="ManualClose"
        ManualCloseButtonText="Close">
    </telerik:RadToolTip>

    When i click domain checking button it works fine. Then i click username checking button and it works perfect too. But, if i click the domain checking button again it displays the Username tooptip :(

    From this point it displays ONLY the Username tooltip. Domain tooltip is not showing up anymore.

    Any ideas? Thanks

    EDIT: actually nothing works after you display these tooltips. Neither validation nor the other buttons. Whatever you do after that the Username checking tooltip is displayed again and again. Is this sort of bug or i am missing something? Thanks
  4. Answer
    Cori
    Cori avatar
    562 posts
    Member since:
    Jul 2010

    Posted 02 Nov 2010 Link to this post

    If you're setting it using VisibleOnPageLoad, you need to set the RadTooltip's VisibleOnPageLoad property to false on evert postback, otherwise it will keep showing on every postback.

    I feel the first approach I suggested would be better, since you don't need to deal with this kind of situation. You can even set it up to pass the RadTooltip id that you want to show the text.

    I hope that helps.
  5. El
    El avatar
    130 posts
    Member since:
    Dec 2008

    Posted 02 Nov 2010 Link to this post

    Ok but how do i set that property to false? Should i add some code within Load event or what? this is how my code looks like e.g. (Username checking button)

    Protected Sub UsernameAvailibilityButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles UsernameAvailibilityButton.Click
            Dim userInfo As MembershipUser = Membership.GetUser(Username.Text.Trim)
           If userInfo Is Nothing Then
               UsernameAvailibilityToolTip.Text = "<br /><div style=""padding: 10px;"">Gongratulations, " & Username.Text & " is Available</div>"
               UsernameAvailibilityToolTip.VisibleOnPageLoad = True
           Else
               UsernameAvailibilityToolTip.Text = "<br /><div style=""padding: 10px;"">Unfortunately, " & Username.Text & " is Taken</div>"
               UsernameAvailibilityToolTip.VisibleOnPageLoad = True
           End If
       End Sub

  6. El
    El avatar
    130 posts
    Member since:
    Dec 2008

    Posted 04 Nov 2010 Link to this post

    * bump *
  7. Answer
    Cori
    Cori avatar
    562 posts
    Member since:
    Jul 2010

    Posted 05 Nov 2010 Link to this post

    Yes, you set it to false in your Page_Load event.
Back to Top