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

Ajax and Tooltip

5 Answers 88 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
André Freitas
Top achievements
Rank 1
André Freitas asked on 10 Feb 2010, 07:11 PM
I got a page, where I need to do some server side validation, using ajax, since client-side validation its not realy secure (tamper data or similar), but i cant figure out how to show the tooltip based on a server side event.

protected void addwhateverbutton(object sender, someeventargs e)
{
    bool isError = false;
    // do some validation
    // add to the label, inside the tooltip, the right error message and set iserror = true, if theres one.

    if (isError) //showtooltip
    else //dosomething
}

Regards
André

5 Answers, 1 is accepted

Sort by
0
Svetlina Anati
Telerik team
answered on 11 Feb 2010, 09:29 AM
Hello André,

I suggest to try with the server method Show - a sample demo is available below:

http://demos.telerik.com/aspnet-ajax/tooltip/examples/webserviceandshow/defaultcs.aspx

Note, that you should make sure that you update the tooltip with teh ajax request as well and this should achieve teh behavior you need.

Sincerely yours,
Svetlina
the Telerik team

Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
0
André Freitas
Top achievements
Rank 1
answered on 11 Feb 2010, 11:08 AM
I dont intend to use a webservice, or a user control, and I dont find the way to reach my goals, showing conditional, based on a server side if (), using that sample. I tried the server side method, tooltip.Show(), but im missing something, because it reload the pages, even if I put the tooltip and the button in the radajaxmanager.

I already tried all samples, the documentation samples and the demos in telerik site. I already tried the search, and Im without any ideas to get that working, because of that I do appreciate your awnser anyways, any help of any kind is appreciated.

Regards,
André

PS: I have opened a suport ticket about the subject.
0
Accepted
Svetlina Anati
Telerik team
answered on 16 Feb 2010, 10:15 AM
Hi André,

The demo I provided was for demonstration of the server method Show and it works the same manner no matter you use a WebService or not. However, I see that I was not clear enough and thus I prepared a test demo based on the code you have provided in your support ticket and for your convenience and for others who might encounter the same problem I pasted its code below:

<%@ Page Language="C#" %>
  
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="mng" runat="server">
        </asp:ScriptManager>
  
        <script type="text/C#" runat="server">
          
            protected void imbAdd_Click(object sender, EventArgs e)
            {
                bool isError = bool.Parse(flag.Value);
                if (isError == false)
                {
                    label1.Text = "correct data in field #";
                    tip.VisibleOnPageLoad = false;
                }
                else
                {
                    label1.Text = "bad data in field #";
                    tip.Show();
                }
                flag.Value = (!bool.Parse(flag.Value)).ToString();
            }
          
        </script>
  
        <telerik:RadAjaxManager ID="RadAjaxManager" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="imbAdd">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="label1" />
                        <telerik:AjaxUpdatedControl ControlID="tip" />
                        <telerik:AjaxUpdatedControl ControlID="flag" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <asp:HiddenField ID="flag" runat="server" Value="true" />
        <asp:Label ID="label1" runat="server" Text="Label"></asp:Label>
        <asp:ImageButton ID="imbAdd" runat="server" ImageUrl="~/App_Themes/Site/Image/Continue.gif"
            CssClass="imbAdd" AlternateText="Continue" ToolTip="Continue" OnClick="imbAdd_Click" />
        <telerik:RadToolTip ID="tip" runat="server" RelativeTo="browserWindow" Position="center"
            Width="200" Height="200" runat="server" Text="Error" ShowEvent="FromCode">
        </telerik:RadToolTip>
    </form>
</body>
</html>

I hope this is helpful, let me know how it goes.


Greetings,
Svetlina
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
André Freitas
Top achievements
Rank 1
answered on 18 Feb 2010, 01:37 PM
Its working now. Im doing a few tests, and Ill let you know if I find any surprieses.

Thank you very much.
0
Svetlina Anati
Telerik team
answered on 18 Feb 2010, 02:53 PM
Hello André,

I am glad I could help! In case you encounter any problems while testing or additional questions arise, do not hesitate to contact us again.


Regards,
Svetlina
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
ToolTip
Asked by
André Freitas
Top achievements
Rank 1
Answers by
Svetlina Anati
Telerik team
André Freitas
Top achievements
Rank 1
Share this question
or