Radtooltip + Validation + Radbutton

2 posts, 0 answers
  1. Fraser
    Fraser avatar
    5 posts
    Member since:
    Sep 2011

    Posted 16 Nov 2011 Link to this post

    I followed the documentation on using the radtooltip with a standard asp validation summary and standard asp button as per on page:


    And successfully got this working, but when I tried to use a radbutton instead of a standard asp button I get a microsoft JScript runtime error: Object Expected

    Below is my code:

    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="nomastervaltest.aspx.vb"
        Inherits="nomastervaltest" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <form id="form1" runat="server">
            <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
            <script type="text/javascript">
                function HideTooltip() {
                    var tooltip = Telerik.Web.UI.RadToolTip.getCurrent();
                    if (tooltip) tooltip.hide();

                function ShowTooltip() {
                    window.setTimeout(function () {
                        var tooltip = $find("RadToolTip1");
                        //API: show the tooltip
                    }, 10);

                function CheckIfShow(sender, args) {
                    var summaryElem = document.getElementById("ValidationSummary1");

                    //check if summary is visible
                    if (summaryElem.style.display == "none") {
                        //API: if there are no errors, do not show the tooltip

            <asp:TextBox ID="txtCompany" runat="server"></asp:TextBox>
            <asp:RequiredFieldValidator ID="rfvCompany" runat="server" ControlToValidate="txtCompany"
                Text="!" ErrorMessage="The company name is obligatory!">
            <telerik:RadButton ID="btnSubmit" Text="Submit" runat="server" OnClientClicking="ShowTooltip()">
            <telerik:RadToolTip runat="server" ID="RadToolTip1" Position="TopRight" HideEvent="ManualClose"
                ShowEvent="FromCode" Width="300px" RelativeTo="Element" EnableShadow="true" OnClientBeforeShow="CheckIfShow"
               <asp:ValidationSummary ID="ValidationSummary1" runat="server"/>

    Many thanks for your help...
  2. Marin Bratanov
    Marin Bratanov avatar
    3555 posts

    Posted 16 Nov 2011 Link to this post

    Hello Fraser,

    I just answered your support ticket on the matter and I will also paste the important information here for others who may encounter a similar issue. I kindly ask that you post only one thread per issue in the future.

    Your issue stems from the way event handlers should be attached to the RadControls. You only need to pass the function name, without the parentheses:
    <telerik:RadButton ID="btnSubmit" Text="Submit" runat="server" OnClientClicking="ShowTooltip"

    All the best,
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  3. DevCraft R3 2016 release webinar banner
Back to Top