if u want to make use of javascript
try tis
function fnGo() {
lblMsg.innerHTML = "";
var Mon = new Date();
var CurMonth = Mon.getMonth() + 1;
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth() + 1;
var yyyy = today.getFullYear();
if (dd < 10) { dd = '0' + dd } if (mm < 10) { mm = '0' + mm } var today = mm + '/' + dd + '/' + yyyy;
var fromdt=document.getElementById("txtstartdate").value;
var todt=document.getElementById("txtenddate").value;
var dtexp = fromdt.split("-")[1] + '/' + fromdt.split("-")[0] + "/" + fromdt.split("-")[2];
var Mon = todt .split("-")[1] + '/' + todt .split("-")[0] + "/" + fodt.split("-")[2];
if (Date.parse(dtexp) > Date.parse(today)) {
lblMsg.innerText = "The From Date should be less than or equal to the Current Date";
document.getElementById("txtstartdate").focus();
return false;
}
if (Date.parse(Mon) > Date.parse(today)) {
lblMsg.innerText = "The To Date should be less than or equal to the Current Date";
document.getElementById("txtenddate").focus();
return false;
}
if (Date.parse(dtexp) > Date.parse(Mon)) {
lblMsg.innerText = "The From Date should be less than or equal to the To Date";
document.getElementById("txtstartdate").focus();
return false;
}
aspx:
<asp:textbox id="txtbatchname" runat="server" readonly="true" xmlns:asp="#unknown">
<asp:Calendar ID="Calendar1" runat="server" OnSelectionChanged="Calendar1_SelectionChanged">
</asp:Calendar>
code behind:
------------
protected void Calendar1_SelectionChanged(object sender, EventArgs e)
{
txtstartdate.Text = Calendar1.SelectedDate.ToString();
}
u can use calendar control like tis for both textbox.
However jquery datepicker is an easy way to accomplish tis task