Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8956589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:49:17+00:00 2026-06-15T14:49:17+00:00

I have a ascx file in which i have placed the below code: <%@

  • 0

I have a ascx file in which i have placed the below code:

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<asp:TextBox ID="textboxDate" runat="server" CssClass="FieldValue" MaxLength="10"
Columns="12" autocomplete="off" Style="padding-right: 18px; border: 1px solid #567890;" />
<ajaxToolkit:CalendarExtender ID="calendarExtenderDate" runat="server" TargetControlID="textboxDate"
PopupButtonID="textboxDate" />

<asp:RequiredFieldValidator runat="server" Enabled="false" ControlToValidate="textboxDate"
ID="valRequired" ErrorMessage="* This field is required" EnableClientScript="true"
Display="Dynamic" Text="*" />

<asp:CompareValidator runat="server" CssClass="error" ControlToValidate="textboxDate"
Operator="DataTypeCheck" Display="Dynamic" Type="Date" ID="valValidDate" ErrorMessage="* Date is in an incorrect format"
Text="*" EnableClientScript="true" />


<asp:CustomValidator CssClass="error" Text="*" runat="server" ID="rangeVal" Display="dynamic" OnServerValidate="rangeVal_Validate" />

I’m calling this user control in one of my form by

 <uc:DateControl ID="dateControlStart" runat="server" RequiredErrorMessage="please enter date" />

So , i want if user select any date which is less than or equal to current date an error should come saying “incorrect error”. I want to do this validation in the aspx page on client side not in user control. Can any one help me?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T14:49:18+00:00Added an answer on June 15, 2026 at 2:49 pm
    <asp:CustomValidator ID="uxDateFormatValidator" runat="server" ControlToValidate="dateControlStart$textboxDate"
    Display="Static" ErrorMessage="Error" ClientValidationFunction="ValidateDateAgainstMinDate"
     />
    
     function ValidateDateAgainstMinDate(oSrc, args) {
    var dateParts = args.Value.split('.');// which separator do you use?
    if (dateParts.length >= 3) {
        var day = dateParts[2];
        var month = dateParts[1] - 1; //this one rocks
        var year = dateParts[0];
        var date = new Date(year, month, day);
        var minDate = new Date(1900, 0, 1); // use just new Date(); for today
        args.IsValid = date >= minDate
            && date.getDate() == day
            && date.getMonth() == month
            && date.getFullYear() == year;
    }
    else {
        args.IsValid = false;
    }
    

    }

    CustomValidator have to insert in your page together with your uc:DateControl

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an asp:FormView on a control (in an ascx file) which is loaded
I have an ASP.NET user control (.ascx file). In this user control I want
I am working on ASP.NET MVC3. I have a partial view RestaurantAdminNavigation.ascx which i
I have a UserControl which rather than putting tags into its ascx markup file,
I have a file called TopicTree.ascx.cs which I am trying to output encoded strings
Background I have a User Control (an .ascx file) which is being dynamically inserting
I have this page, shown below. In the ASCX file, the data is generated
I have two .ascx files in the same folder in an ASP.NET MVC project.
For example, i have this ImageViewer.ascx UserControl: <div class=ImageTumbnails> <asp:ListView ID=ImageList runat=server ItemPlaceholderID=ItemContainer> <LayoutTemplate>
I have made a basic ascx control which is just a panel with a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.