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

RatTooltip Validation issue

3 Answers 62 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
Bill
Top achievements
Rank 1
Bill asked on 12 Aug 2012, 04:50 PM
Referring to the attached code for my usercontrol, the comments dialog (tooltip) pops up fine and saves fine if I do not use any validators or set the save button to causesValidation="false"
If I add one or more validators (all but 1 commented out), the validation fires if I leave the field blank but if I enter text, I dont get any validation errors but the onclick doesnt fire.

Any ideas?

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ctrlDealRatings.ascx.vb" Inherits="DealNutWebsite.ctrlDealRatings" %>
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
 
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
 
    <script type="text/javascript" id="telerikClientEvents1">
        //<![CDATA[
 
        function OnClientRated(controlRating, args) {
            var tooltip = $find("<%=RadToolTip1.ClientID %>");
            tooltip.show();
        }
 
        function HideTooltip(controlRating, args) {
            var tooltip = $find("<%=RadToolTip1.ClientID %>");
            tooltip.hide();
            return (false);
        }
        //]]>
    </script>
</telerik:RadCodeBlock>
 
<div id="DealRatingDiv" runat="server" visible="true" style="position:relative;top:0px;width:200px;border:0px solid red">
    <asp:Label class="CaptionSm" ID="lblCaption" runat="server" Text="Click a Nut to Rate:" style="float:left; margin-top: 6px"></asp:Label>
 
    <div style="float:left; margin-top: 0px">
 
        <telerik:RadRating ID="RadDealRating" runat="server" Skin="MyCustomSkin" AutoPostBack="false"
                           readonly="true"  EnableEmbeddedSkins="false" EnableEmbeddedBaseStylesheet="false" OnClientRated="OnClientRated"
                           Precision="half" />
    </div>
 
</div>
 
<p></p>
<telerik:RadToolTip ID="RadToolTip1" runat="server"
                    ShowEvent="FromCode" HideEvent="FromCode"
                    TargetControlID="RadDealRating"
                    AutoCloseDelay="1000" ShowCallout="true"
                    Position="MiddleLeft" Width="275px"
                    Animation="Resize" ManualClose="True"
                    Height="300px" >
    <div class="AddDealRatingbox">
        <asp:Image ID="Image1" runat="server" ImageUrl="/Images/RateThisDeal.png" />
        <br />
        <asp:Label ID="lblName" runat="server" Text="Name:"></asp:Label>
        <br />
        <asp:TextBox ID="txtName" runat="server" style="width:260px" />
        <%--
        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
        CssClass="Errors"
        ControlToValidate="txtName"
        ErrorMessage="Your name is required"
        SetFocusOnError="True" >Your name is required</asp:RequiredFieldValidator>
        <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server"
        ControlToValidate="txtName"
        ErrorMessage="Please use plain text only"
        Text="Please use plain text only"
        CssClass="Errors"
        ValidationExpression="[^<]+"
        SetFocusOnError="True" />
        --%>
         <br />
        <br />
        <asp:Label ID="lblInstructions" runat="server" Text="Your feedback:"></asp:Label>
        <br />
        <asp:TextBox ID="txtComments" runat="server" TextMode="MultiLine"  Rows="5" Columns="30" style="width:260px" />
        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
                                    ValidationGroup="save"    CssClass="Errors" ControlToValidate="txtComments"
                                    ErrorMessage="Your comment is required"
                                    EnableViewState="False" ViewStateMode="Disabled" >Your comment is required</asp:RequiredFieldValidator>
        <%--   
        <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"
        ControlToValidate="txtComments"
        ErrorMessage="Please use plain text only"
        text="Please use plain text only"
        CssClass="Errors" ValidationExpression="[^<]+"
        SetFocusOnError="True" />
        --%>
        <br /><br />
 
        <asp:ImageButton ID="btnPostComment" runat="server"
                         Style="outline:0; cursor:pointer" ValidationGroup="save"
                         ImageUrl="~/Images/btnPostComment.png" OnClick="btnPostComment_Click" CausesValidation="True" />
        <asp:ImageButton ID="btnCancel" UseSubmitBehavior="false" runat="server"
                         Style="margin-left:12px; outline:0; cursor:pointer"
                         OnClientClick="HideTooltip()" ImageUrl="~/Images/btnCancel.png" />
    </div>
</telerik:RadToolTip>

3 Answers, 1 is accepted

Sort by
0
Kevin
Top achievements
Rank 2
answered on 14 Aug 2012, 12:26 PM
Hello Bill,

I noticed that the validator controls you have commented out don't have their ValidationGroup property set. That would the reason your validators aren't firing.

I hope that helps.
0
Bill
Top achievements
Rank 1
answered on 14 Aug 2012, 08:33 PM
I tried it with and without the group properties. No difference.
0
Marin Bratanov
Telerik team
answered on 16 Aug 2012, 11:03 AM
Hi Bill,

You would need to set ValidationGroup for all controls that take part in the logic. I tried this scenario and it works fine on my end. I also suggest you make sure you have added the event handler properly for VB - you have AutoEventWireup=false in the control directive. I am attaching here my sample page along with a video from my test as a reference.


Greetings,
Marin Bratanov
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.
Tags
ToolTip
Asked by
Bill
Top achievements
Rank 1
Answers by
Kevin
Top achievements
Rank 2
Bill
Top achievements
Rank 1
Marin Bratanov
Telerik team
Share this question
or