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

RadToolTip

6 Answers 98 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
El
Top achievements
Rank 1
El asked on 01 Nov 2010, 11:50 AM
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

6 Answers, 1 is accepted

Sort by
0
Cori
Top achievements
Rank 2
answered on 01 Nov 2010, 01:12 PM
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.
0
El
Top achievements
Rank 1
answered on 01 Nov 2010, 08:12 PM
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
0
Accepted
Cori
Top achievements
Rank 2
answered on 02 Nov 2010, 01:07 PM
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.
0
El
Top achievements
Rank 1
answered on 02 Nov 2010, 09:34 PM
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

0
El
Top achievements
Rank 1
answered on 04 Nov 2010, 01:25 PM
* bump *
0
Accepted
Cori
Top achievements
Rank 2
answered on 05 Nov 2010, 01:02 PM
Yes, you set it to false in your Page_Load event.
Tags
Ajax
Asked by
El
Top achievements
Rank 1
Answers by
Cori
Top achievements
Rank 2
El
Top achievements
Rank 1
Share this question
or