+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / RadAjaxPanel only working after postback

RadAjaxPanel only working after postback

7 posts, 0 answered
  1. Luc Baeten
    Luc Baeten avatar
    169 posts
    Registered:
    23 Sep 2005
    28 Jul 2010
    Link to this post
    Hello Sitefinity team

    I have problems with using RadAjaxPanel in a custom control. When I use the custom control on a page the RadAjsaxPanel doesn't work after first initalisation. It only works after postback.

    To show you the problem I brought the functionalit back to a very simple test custom control:

    test.ascx template

    <%@ Control Language="C#" AutoEventWireup="true" %>
    <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
      
        <script type="text/javascript">
            function KeyPressInput(sender, e) {
                var c = e.get_keyCode();
                if (c == 13) {
                    //Enter key press
                    //if the value of the input field hasn't been changed, we still need a postback when pressing the enter key
                    var bt = document.getElementById('<%= btnDefaultSubmit.ClientID %>');
                    if (bt) bt.click();
                    //special handling (focus other control and so on) here
                    e.set_cancel(true);
                }
            }
      
        </script>
      
    </telerik:RadCodeBlock>
    <telerik:RadAjaxLoadingPanel runat="server" ID="RadAjaxLoadingPanel1" Skin="Vista">
    </telerik:RadAjaxLoadingPanel>
    <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="RadAjaxLoadingPanel1"
        EnableAJAX="true">
        <div id="MainNewOrder" runat="server">
            <table>
                <tr>
                    <td>
                        <asp:Label ID="lblComments" runat="server" Text="Comments"></asp:Label>
                    </td>
                    <td>
                        <telerik:RadTextBox ID="txtCommentsInput" runat="server">
                            <ClientEvents OnKeyPress="KeyPressInput" />
                        </telerik:RadTextBox>
                    </td>
                </tr>
            </table>
        </div>
        <asp:Button ID="btnDefaultSubmit" runat="server" Text="Submit" />
    </telerik:RadAjaxPanel>


    test.cs code:

    using System;
    using System.Web.UI;
    using System.Web.UI.WebControls;
      
    namespace GBdealer.WebControls.WebClasses
    {
        class Test : Telerik.Cms.Web.UI.SimpleControl
        {
      
            /// <summary>
            /// Initalize the used child controls in the Order Product List custom control
            /// </summary>
            /// <param name="controlContainer">Main custom control</param>
            protected override void InitializeControls(Control controlContainer)
            {
                //add other logic here
                base.InitializeControls(controlContainer);
      
                try
                {
                    btnDefaultSubmit.Click += new EventHandler(btnDefaultSubmit_Click);
                }
                catch (Exception ex)
                {
                    throw;
                }
            }
      
      
            protected void btnDefaultSubmit_Click(object sender, EventArgs e)
            {
            }
      
      
            protected virtual Button btnDefaultSubmit
            {
                get
                {
                    return base.Container.GetControl<Button>("btnDefaultSubmit", true);
                }
            }
      
            /// <summary>
            /// Define Template for custom control
            /// </summary>
            public override string LayoutTemplateName
            {
                get
                {
                    return layoutTemplateName;
                }
            }
      
            [WebSysTemplate(layoutTemplateName, "This is a description", "~/Templates/Test.ascx", true, "2010-04-15")]
            public override string LayoutTemplatePath
            {
                get
                {
                    return base.LayoutTemplatePath;
                }
                set
                {
                    base.LayoutTemplatePath = value;
                }
            }
      
            public override Type LocalizationAssemblyInfo
            {
                get
                {
                    return base.LocalizationAssemblyInfo;
                }
                set
                {
                    base.LocalizationAssemblyInfo = value;
                }
            }
      
            protected const string layoutTemplateName = "GBdealer.WebControls.Templates.Test.ascx";
      
        }
    }


    Whatever I do (pressing the submit button, or defining a value and press the enter key) when the page is shown at initialisation (thus without postback), a full page postback is carried out. After the postback the Ajax panel is working as expected.

    Have you any idea how I can solve this problem (Ajax panel working at start)?

    Kind regards
    Luc Baeten
  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    28 Jul 2010
    Link to this post
    Hello Luc Baeten,

    Thank you for using our services.

    Due to some differences in the page/control life cycle when using custom controls I think that the only way to achieve this in a manner similar to one discussed in a previous thread of yours. Could you try with the following modifications in the code:
    protected override void InitializeControls(Control controlContainer)
    {
        //add other logic here
        base.InitializeControls(controlContainer);         
        this.RadAjaxPanel1.Init += new EventHandler(RadAjaxPanel1_Init);
        try
        {
            btnDefaultSubmit.Click += new EventHandler(btnDefaultSubmit_Click);
        }
        catch (Exception ex)
        {
            throw;
        }
    }
    void RadAjaxPanel1_Init(object sender, EventArgs e)
    {
        RadAjaxManager ajaxManager = RadAjaxManager.GetCurrent(this.Page);
        ajaxManager.AjaxSettings.AddAjaxSetting(btnDefaultSubmit, RadAjaxPanel1, RadAjaxLoadingPanel1);
    }
    ...
    protected virtual RadAjaxPanel RadAjaxPanel1
    {
        get
        {
            return base.Container.GetControl<RadAjaxPanel>("RadAjaxPanel1", true);
        }
    }
    protected virtual RadAjaxLoadingPanel RadAjaxLoadingPanel1
    {
        get
        {
            return base.Container.GetControl<RadAjaxLoadingPanel>("RadAjaxLoadingPanel1", true);
        }
    }


    Greetings,
    Radoslav Georgiev
    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
  3. Luc Baeten
    Luc Baeten avatar
    169 posts
    Registered:
    23 Sep 2005
    28 Jul 2010
    Link to this post
    Hello Radoslav

    I didn't recognize it as the same problem but in fact it is. I am sorry to disturb you twice with the same problem.
    But it helped me again to solve the problem. Thanks again.

    Kind regards
    Luc
  4. Luc Baeten
    Luc Baeten avatar
    169 posts
    Registered:
    23 Sep 2005
    02 Aug 2010
    Link to this post
    Hello Radoslav

    Working further on the custom control in combination with the RadAjaxPanel I encounter an other problem:

    I have a test control with two fields, the second field will be shown after a submit of the first field. On the second field two vaildators are defined: requiredfieldvalidator and rangevalidator. When one of the two validators is invalid I want to show a RadToolTip with the error message. This tooltip will never be shown because I do get always a postback. After postback the wrong validator info is shown.
    However I want to present the Tooltip as long as the validators are invalid. The postback should only be started when both the validators are valid.

    custom ascx template:
    <%@ Control Language="C#" AutoEventWireup="true" %>
    <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
      
    <script type="text/javascript">
        //<![CDATA[
      
        function ShowTooltip() {
      
            var summaryElem = document.getElementById('<%= ValidationSummary1.ClientID %>');
      
            //check if summary is visible
            if (summaryElem.style.display == "none") {
                return true;
            }
            else {
                window.setTimeout(function() {
                    var tooltip = $find("<%= RadToolTip1.ClientID %>");
                    //API: show the tooltip
                    tooltip.show();
                }, 10);
                return false;
            }
      
        }
      
        function CheckIfShow(sender, args) {
            var summaryElem = document.getElementById("<%= ValidationSummary1.ClientID %>");
      
            //check if summary is visible
            if (summaryElem.style.display == "none") {
                //API: if there are no errors, do not show the tooltip
                args.set_cancel(true);
            }
        }
      
        function KeyPressValidateInput(sender, e) {
            var c = e.get_keyCode();
            if (c == 13) {
                //Enter key press
                //alert('oke');
                var val = sender.get_value();
                if (val != "") {
                    //if the value of the input field hasn't been changed, we still need a postback when pressing the enter key
                    var bt = document.getElementById('<%= btnSubmit.ClientID %>');
                    if (bt) bt.click();
                }
                //special handling (focus other control and so on) here
                e.set_cancel(true);
            }
        }
      
        function KeyPressInput(sender, e) {
            var c = e.get_keyCode();
            if (c == 13) {
                //Enter key press
                //if the value of the input field hasn't been changed, we still need a postback when pressing the enter key
                var bt = document.getElementById('<%= btnSubmit.ClientID %>');
                if (bt) bt.click();
                //special handling (focus other control and so on) here
                e.set_cancel(true);
            }
        }
        //]]>
    </script>
      
    <telerik:RadAjaxLoadingPanel runat="server" ID="RadAjaxLoadingPanel1" Skin="Vista">
    </telerik:RadAjaxLoadingPanel>
    <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="RadAjaxLoadingPanel1"
        EnableAJAX="true">
        <div id="MainNewOrder" runat="server">
            <table>
                <tr>
                    <td>
                        <asp:Label ID="lblComments" runat="server" Text="Comments"></asp:Label>
                    </td>
                    <td>
                        <telerik:RadTextBox ID="txtCommentsInput" runat="server">
                            <ClientEvents OnKeyPress="KeyPressInput" />
                        </telerik:RadTextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="Label1" runat="server" Text="Validation"></asp:Label>
                    </td>
                    <td>
                        <telerik:RadNumericTextBox ID="txtFirstName" CausesValidation="false" AllowOutOfRangeAutoCorrect="false"
                            runat="server" Type="Number" Visible="false">
                            <ClientEvents OnKeyPress="KeyPressValidateInput" />
                            <NumberFormat AllowRounding="true" KeepNotRoundedValue="false" DecimalDigits="0" />
                        </telerik:RadNumericTextBox>
                        <asp:RequiredFieldValidator ID="rfvFirstName" runat="server" ControlToValidate="txtFirstName"
                            Text=". required" ErrorMessage="Name field is required" Display="Dynamic" Visible="false">
                        </asp:RequiredFieldValidator>
                        <asp:RangeValidator ID="rgv_input" runat="server" ControlToValidate="txtFirstName"
                            Display="Dynamic" ErrorMessage="Minimum or maximum boundary" Text=". boundary" Visible="false"
                            MinimumValue="200" MaximumValue="500" Type="Integer" />
                    </td>
                </tr>
            </table>
        </div>
        <asp:Button ID="btnSubmit" OnClientClick="if (!ShowTooltip()) return false;" Text="Submit" runat="server" />
    </telerik:RadAjaxPanel>
    <telerik:RadToolTip runat="server" ID="RadToolTip1" Position="MiddleRight" ShowEvent="FromCode"
        Width="300px" RelativeTo="Element" EnableShadow="true" OnClientBeforeShow="CheckIfShow"
        TargetControlID="txtFirstName">
        <asp:ValidationSummary ID="ValidationSummary1" runat="server" />
    </telerik:RadToolTip>


    code behind

    using System;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using Telerik.Web.UI;
      
    namespace GBdealer.WebControls.WebClasses
    {
        class Test : Telerik.Cms.Web.UI.SimpleControl
        {
      
            /// <summary>
            /// Initalize the used child controls in the Order Product List custom control
            /// </summary>
            /// <param name="controlContainer">Main custom control</param>
            protected override void InitializeControls(Control controlContainer)
            {
                //add other logic here
                base.InitializeControls(controlContainer);
      
                try
                {
                    RadAjaxPanel1.Init += new EventHandler(RadAjaxPanel1_Init); 
                    btnSubmit.Click += new EventHandler(btnSubmit_Click);
                }
                catch (Exception ex)
                {
                    throw;
                }
            }
      
            void RadAjaxPanel1_Init(object sender, EventArgs e)
            {
                RadAjaxManager ajaxManager = RadAjaxManager.GetCurrent(this.Page);
                ajaxManager.AjaxSettings.AddAjaxSetting(btnSubmit, RadAjaxPanel1, RadAjaxLoadingPanel1);
            }
      
      
            protected void btnSubmit_Click(object sender, EventArgs e)
            {
                txtFirstName.Visible = true;
                rfvFirstName.Visible = true;
                rgv_input.Visible = true;
            }
      
      
            protected virtual Button btnSubmit
            {
                get
                {
                    return base.Container.GetControl<Button>("btnSubmit", true);
                }
            }
      
            protected virtual RadAjaxPanel RadAjaxPanel1
            {
                get
                {
                    return base.Container.GetControl<RadAjaxPanel>("RadAjaxPanel1", true);
                }
            }
      
            protected virtual RadAjaxLoadingPanel RadAjaxLoadingPanel1
            {
                get
                {
                    return base.Container.GetControl<RadAjaxLoadingPanel>("RadAjaxLoadingPanel1", true);
                }
            }
      
            protected virtual RadNumericTextBox txtFirstName
            {
                get
                {
                    return base.Container.GetControl<RadNumericTextBox>("txtFirstName", true);
                }
            }
      
            protected virtual RequiredFieldValidator rfvFirstName
            {
                get
                {
                    return base.Container.GetControl<RequiredFieldValidator>("rfvFirstName", true);
                }
            }
      
            protected virtual RangeValidator rgv_input
            {
                get
                {
                    return base.Container.GetControl<RangeValidator>("rgv_input", true);
                }
            }
      
      
            /// <summary>
            /// Define Template for custom control
            /// </summary>
            public override string LayoutTemplateName
            {
                get
                {
                    return layoutTemplateName;
                }
            }
      
            [WebSysTemplate(layoutTemplateName, "This is a description", "~/Templates/Test.ascx", true, "2010-04-15")]
            public override string LayoutTemplatePath
            {
                get
                {
                    return base.LayoutTemplatePath;
                }
                set
                {
                    base.LayoutTemplatePath = value;
                }
            }
      
            public override Type LocalizationAssemblyInfo
            {
                get
                {
                    return base.LocalizationAssemblyInfo;
                }
                set
                {
                    base.LocalizationAssemblyInfo = value;
                }
            }
      
            protected const string layoutTemplateName = "GBdealer.WebControls.Templates.Test.ascx";
      
        }
    }

    Have you any idea how I can solve this?

    Kind regards
    Luc
  5. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    03 Aug 2010
    Link to this post
    Hi Luc Baeten,

    Have you tried the approach in this blog post: Showing RadToolTip on RadInput input error?

    All the best,
    Radoslav Georgiev
    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. Luc Baeten
    Luc Baeten avatar
    169 posts
    Registered:
    23 Sep 2005
    04 Aug 2010
    Link to this post
    Hi Radoslav

    Thank you for mentioning this post. This is much simpler than the solution I used.
    However the difficulty increases when using custom controls. When working with aspx page everything works fine but using custom controls problem starts. Therefor I used the code and added it to my custom test control.

    After a postback the test control must show the input field with minimum and maximum value defined in the RadInputManager. This Numeric InputSetting is defined in Codebehind.
    So after Postback everything is shown correctly. When filling in an incorrect number (ie. 1) in the Number field and pressing the submit button everythingh works fine: the Tooltip is shown correctly without a postback.

    However when I filling in an incorrect number (ie. 1) in the Number field and pressing the enter key the form is submitted although the value in the Number field isn't correct. As you can see in the ascx template I defined a panel with a DefaultButton parameter.

    How can I enter through the fields and postback when the value is correct and not postback when the value isn't correct, but shoing the Tooltip?
    I need to walk thorugh the fields by defining a value and pressi8ng the enter key. After a postback the next field is shown.

    I also do have an extra complexity: when I use a RadAjaxPanel around the controls also the Submit button selection and Input manager check don't work anymore.

    ascx template:
    <%@ Control Language="C#" AutoEventWireup="true" %>
    <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
    <div>
        <telerik:RadInputManager ID="RadInputManager1" runat="server">
            <telerik:NumericTextBoxSetting>
            </telerik:NumericTextBoxSetting>
        </telerik:RadInputManager>
        <telerik:RadToolTipManager ID="RadToolTipManager1" runat="server" Position="MiddleRight"
            RelativeTo="Element" AutoTooltipify="false" Skin="Hay" Animation="Fade" ShowEvent="FromCode"
            HideEvent="FromCode">
        </telerik:RadToolTipManager>
    </div>
      
    <asp:Panel ID="Panel1" DefaultButton="btnSubmit" runat="server">
        <h1>
            Enter your details</h1>
        Enter your comments:
        <asp:TextBox runat="server" ID="txtComments" OnTextChanged="KeyPressInput"></asp:TextBox><br />
        Enter your number:
        <asp:TextBox runat="server" ID="txtNumber" Visible="false"></asp:TextBox><br />
        <asp:Button ID="btnSubmit" Text="Submit" runat="server" />
    </asp:Panel>
              
    <script type="text/javascript">
        var errorCount = 0; //Keep track of Numeric input errors
        var tooltipManager = null; //Ref to tooltipManager
      
        //Handles Numeric input errors (fires as user types error)
        function onClientNumTxtError(sender, args) {
            errorCount += 1;
      
            //Get DOM reference to textbox
            var eleId = args.get_targetInput().get_id();
            var ele = $get(eleId);
      
            //Try to get max/min setting for input control
            var max = sender.get_maxValue();
            var min = sender.get_minValue();
            var errMsg = "Value out of range";
      
            //If min or max value are set, try to customize error message
            if (max != null && min != null)
                errMsg = String.format("Value must be between {0} and {1}", min, max);
            else if (max != null && min == null)
                errMsg = String.format("Value may not be higher than {0}", max);
            else if (max == null && min != null)
                errMsg = String.format("Value may not be lower than {0}", min);
      
            //Show error tip
            showErrorTip(ele, errMsg);
        }
      
        //Displays ToolTip with supplied message
        function showErrorTip(element, msg) {
            //Init tooltipmanager reference (if necessary)
            if (tooltipManager == null)
                tooltipManager = $find("<%= RadToolTipManager1.ClientID %>");
            //If the user hovers the image before the page has loaded, there is no manager created
            if (!tooltipManager) return;
      
            //Find the tooltip for this element if it has been created
            var tooltip = tooltipManager.getToolTipByElement(element);
      
            //Create a tooltip if no tooltip exists for such element
            if (!tooltip)
                tooltip = tooltipManager.createToolTip(element);
      
            //Set tooltip details
            tooltip.set_content(msg);
            tooltip.set_autoCloseDelay(5000);
            tooltip.set_manualClose(false);
            tooltip.show();
        }
      
        //Handle the OnKeyPress event of RadInput
        function onClientTextChanged(sender, args) {
            //Hide any open tips on typing
            HideTooltip();
        }
      
        //Hides the open ToolTip (if there is one)
        function HideTooltip() {
            var tip = Telerik.Web.UI.RadToolTip.getCurrent();
            if (tip) tip.hide();
        }
                
    </script>


    code behind:

    using System;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using Telerik.Web.UI;
      
    namespace GBdealer.WebControls.WebClasses
    {
        class Test : Telerik.Cms.Web.UI.SimpleControl
        {
      
            /// <summary>
            /// Initalize the used child controls in the Order Product List custom control
            /// </summary>
            /// <param name="controlContainer">Main custom control</param>
            protected override void InitializeControls(Control controlContainer)
            {
                //add other logic here
                base.InitializeControls(controlContainer);
      
                try
                {
                    btnSubmit.Click += new EventHandler(btnSubmit_Click);
                }
                catch (Exception ex)
                {
                    throw;
                }
            }
      
            protected void btnSubmit_Click(object sender, EventArgs e)
            {
                txtNumber.Visible = true;
      
                NumericTextBoxSetting numSet = (NumericTextBoxSetting)RadInputManager1.InputSettings[0];
                numSet.MinValue = 10;
                numSet.MaxValue = 100;
                numSet.ClientEvents.OnError = "onClientNumTxtError";
                numSet.ClientEvents.OnKeyPress = "onClientTextChanged";
                RadInputManager1.InputSettings[0].TargetControls.Add(new TargetInput(txtNumber.UniqueID, true));
            }
      
            protected virtual Button btnSubmit
            {
                get
                {
                    return base.Container.GetControl<Button>("btnSubmit", true);
                }
            }
      
            protected virtual TextBox txtNumber
            {
                get
                {
                    return base.Container.GetControl<TextBox>("txtNumber", true);
                }
            }
      
            protected virtual RadInputManager RadInputManager1
            {
                get
                {
                    return base.Container.GetControl<RadInputManager>("RadInputManager1", true);
                }
            }
      
              
            /// <summary>
            /// Define Template for custom control
            /// </summary>
            public override string LayoutTemplateName
            {
                get
                {
                    return layoutTemplateName;
                }
            }
      
            [WebSysTemplate(layoutTemplateName, "This is a description", "~/Templates/Test.ascx", true, "2010-04-15")]
            public override string LayoutTemplatePath
            {
                get
                {
                    return base.LayoutTemplatePath;
                }
                set
                {
                    base.LayoutTemplatePath = value;
                }
            }
      
            public override Type LocalizationAssemblyInfo
            {
                get
                {
                    return base.LocalizationAssemblyInfo;
                }
                set
                {
                    base.LocalizationAssemblyInfo = value;
                }
            }
      
            protected const string layoutTemplateName = "GBdealer.WebControls.Templates.Test.ascx";
      
        }
    }

    Regards
    Luc
  7. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    10 Aug 2010
    Link to this post
    Hi Luc Baeten,

    I was getting some errors that there is no method for OnClientBlur method when I copy/pasted the sample markup from Todd's blog. There were no problems using the tooltip. I have used bellow markup to try out the control:
    <%@ Control Language="C#" AutoEventWireup="true" %>
    <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
    <div>
        <telerik:RadInputManager ID="RadInputManager1" runat="server">
            <telerik:NumericTextBoxSetting MinValue="0" MaxValue="115">
                <ClientEvents OnError="onClientNumTxtError" OnBlur="onClientTxtBlur" OnKeyPress="onClientTextChanged" />
                <TargetControls>
                    <telerik:TargetInput ControlID="txtNumber" />
                </TargetControls>
            </telerik:NumericTextBoxSetting>
        </telerik:RadInputManager>
        <telerik:RadToolTipManager ID="RadToolTipManager1" runat="server" Position="MiddleRight"
            RelativeTo="Element" AutoTooltipify="false" Skin="Hay" Animation="Fade" ShowEvent="FromCode"
            HideEvent="FromCode">
        </telerik:RadToolTipManager>
    </div>
       
    <asp:Panel ID="Panel1" DefaultButton="btnSubmit" runat="server">
        <h1>
            Enter your details</h1>
        Enter your comments:
        <asp:TextBox runat="server" ID="txtComments" OnTextChanged="KeyPressInput"></asp:TextBox><br />
        Enter your number:
        <asp:TextBox runat="server" ID="txtNumber" ></asp:TextBox><br />
        <asp:Button ID="btnSubmit" Text="Submit" runat="server" />
    </asp:Panel>
               
    <script type="text/javascript">
        var errorCount = 0; //Keep track of Numeric input errors
        var tooltipManager = null; //Ref to tooltipManager
     
        //Handles Numeric input errors (fires as user types error)
        function onClientNumTxtError(sender, args) {
            errorCount += 1;
     
            //Get DOM reference to textbox
            var eleId = args.get_targetInput().get_id();
            var ele = $get(eleId);
     
            //Try to get max/min setting for input control
            var max = sender.get_maxValue();
            var min = sender.get_minValue();
            var errMsg = "Value out of range";
     
            //If min or max value are set, try to customize error message
            if (max != null && min != null)
                errMsg = String.format("Value must be between {0} and {1}", min, max);
            else if (max != null && min == null)
                errMsg = String.format("Value may not be higher than {0}", max);
            else if (max == null && min != null)
                errMsg = String.format("Value may not be lower than {0}", min);
     
            //Show error tip
            showErrorTip(ele, errMsg);
        }
     
        //Displays ToolTip with supplied message
        function showErrorTip(element, msg) {
            //Init tooltipmanager reference (if necessary)
            if (tooltipManager == null)
                tooltipManager = $find("<%= RadToolTipManager1.ClientID %>");
            //If the user hovers the image before the page has loaded, there is no manager created
            if (!tooltipManager) return;
     
            //Find the tooltip for this element if it has been created
            var tooltip = tooltipManager.getToolTipByElement(element);
     
            //Create a tooltip if no tooltip exists for such element
            if (!tooltip)
                tooltip = tooltipManager.createToolTip(element);
     
            //Set tooltip details
            tooltip.set_content(msg);
            tooltip.set_autoCloseDelay(5000);
            tooltip.set_manualClose(false);
            tooltip.show();
        }
     
        //Handle the OnKeyPress event of RadInput
        function onClientTextChanged(sender, args) {
            //Hide any open tips on typing
            HideTooltip();
        }
     
        function onClientTxtBlur(sender, args) {
            //Reset error count
            errorCount = 0;
        }
        //Hides the open ToolTip (if there is one)
        function HideTooltip() {
            var tip = Telerik.Web.UI.RadToolTip.getCurrent();
            if (tip) tip.hide();
        }
                 
    </script>



    Sincerely yours,
    Radoslav Georgiev
    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
Register for webinar
7 posts, 0 answered