Ajax and Tooltip

6 posts, 1 answers
  1. André Freitas
    André Freitas avatar
    23 posts
    Member since:
    Feb 2010

    Posted 10 Feb 2010 Link to this post

    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é
  2. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 11 Feb 2010 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. André Freitas
    André Freitas avatar
    23 posts
    Member since:
    Feb 2010

    Posted 11 Feb 2010 Link to this post

    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.
  5. Answer
    Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 16 Feb 2010 Link to this post

    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.
  6. André Freitas
    André Freitas avatar
    23 posts
    Member since:
    Feb 2010

    Posted 18 Feb 2010 Link to this post

    Its working now. Im doing a few tests, and Ill let you know if I find any surprieses.

    Thank you very much.
  7. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 18 Feb 2010 Link to this post

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017