Comparision of two textboxes using Dates … Calendar Extendar in Asp.net with javascript


Comparision of two textboxes using Dates with calender extender and javascript

try this, it’s works for me.
function CheckValid(){

var fromDate = $(‘#<%=txtFromDt.ClientID %>’).val();
var toDate = $(‘#<%= txtTodt.ClientID %>’).val();
if ((fromDate != “” && toDate != “”) && Date.parse(fromDate) > Date.parse(toDate)) {
// alert(“To date should be greater than From date.”);
$(‘#<%= lblErrorMsg.ClientID %>’).text(‘To date should be greater than From date.’);
return false;
}
}

Advertisements

One Response to Comparision of two textboxes using Dates … Calendar Extendar in Asp.net with javascript

  1. Pankaj Nikam says:

    I would use the StartDate and EndDate for the CalenderExtender so that the user cant even select the invalid values.
    Nice tip though if you want to show an alert… (y)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: