Compare Validator with Rad Time Picker

2 posts, 0 answers
  1. Akhil Raj
    Akhil Raj avatar
    69 posts
    Member since:
    Aug 2012

    Posted 25 Jul 2011 Link to this post

    Hi all,
      I am using Rad Date Ticker and Rad Time Picker for entering date range. For 2 Rad Date Picker i used one compare validator and also use one compare validator for 2 Rad Time Picker. If i chnage any startime i got error from compare validator even if endtime is greater than starttime. For date comparison i added type as date in compare validator. But how can i configure for radtime picker?
    But if i change or just select end time again error is cleared.

    <telerik:RadTimePicker ID="radstarttime" runat="server"  Width="225px" >
        <TimeView CellSpacing="-1" Columns="6" Interval="00:30:00" ></TimeView>
    </telerik:RadTimePicker>
    <asp:RequiredFieldValidator ID="rfvStartTime" Display="Dynamic" ValidationGroup="EditValidation" SetFocusOnError="true" runat="server" ControlToValidate="radstarttime" ErrorMessage="Start Time is Mandatory!!!" Text="*" ForeColor="Red">
    </asp:RequiredFieldValidator>
       
    <telerik:RadTimePicker ID="radendtime" runat="server" Width="225px"
        <TimeView CellSpacing="-1" Columns="6" Interval="00:30:00"></TimeView>
    </telerik:RadTimePicker>
    <asp:RequiredFieldValidator ID="rfvEndTime" Display="Dynamic" ValidationGroup="EditValidation" SetFocusOnError="true" runat="server" ControlToValidate="radendtime" ErrorMessage="End Time is Mandatory!!!" Text="*" ForeColor="Red">
    </asp:RequiredFieldValidator>
      
    <asp:CompareValidator ID="crvEndTime" runat="server" ControlToCompare ="radstarttime" ControlToValidate ="radendtime" Operator ="GreaterThanEqual" ErrorMessage ="End Time Must be Greater than Start Time" >
    </asp:CompareValidator>


  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 26 Jul 2011 Link to this post

    Hello Akhil,

    I have tried to reproduce the issue but no avail. Here is the full code which I tried.
    aspx:
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="TimePicker.aspx.cs" Inherits="Calender_TimePicker" %>
    <%@ 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">
    <body>
        <form id="form1" runat="server">
        <div>
            <asp:ScriptManager ID="ScriptManager1" runat="server">
            </asp:ScriptManager>
            TimePicker
            <telerik:RadTimePicker ID="radstarttime" runat="server" Width="225px">
                <TimeView CellSpacing="-1" Columns="6" Interval="00:30:00" >
                </TimeView>
            </telerik:RadTimePicker>
            <asp:RequiredFieldValidator ID="rfvStartTime" Display="Dynamic" ValidationGroup="EditValidation"
                SetFocusOnError="true" runat="server" ControlToValidate="radstarttime" ErrorMessage="Start Time is Mandatory!!!"
                Text="*" ForeColor="Red">
            </asp:RequiredFieldValidator>
            <telerik:RadTimePicker ID="radendtime" runat="server" Width="225px">
                <TimeView CellSpacing="-1" Columns="6" Interval="00:30:00">
                </TimeView>
            </telerik:RadTimePicker>
            <asp:RequiredFieldValidator ID="rfvEndTime" Display="Dynamic" ValidationGroup="EditValidation"
                SetFocusOnError="true" runat="server" ControlToValidate="radendtime" ErrorMessage="End Time is Mandatory!!!"
                Text="*" ForeColor="Red">
            </asp:RequiredFieldValidator>
            <asp:CompareValidator ID="crvEndTime" runat="server" ControlToCompare="radstarttime"
                ControlToValidate="radendtime" Operator="GreaterThanEqual" ErrorMessage="End Time Must be Greater than Start Time" >
            </asp:CompareValidator>
    <asp:Button ID="Button1" runat="server" Text="Button" />
        </div>
        </form>
    </body>
    </html>
    Please elaborate your scenario if it doesn't help.
    Thanks,
    Shinu,
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top