there must be a validation like " you can't insert record with previous date" ..
how to compare a date?
for example today's date is 20/08/2013 and i try to insert record for date 01/08/2013 then
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sandeep Singh ShekhawatPosted Aug 2, 2013, 2:02 AM
Javascript
function verifyDate(sender, args)
{
var d = new Date();
d.setDate(d.getDate() - 1);
if (sender._selectedDate < d)
{
alert("Date should be Today or Greater than Today");
sender._textbox.set_Value('')
}
}
.aspx Page
<asp:TextBox runat="server" ID="txtDateFrom" Text=" " >asp:TextBox>
<cc1:CalendarExtender ID="CalendarExtender2" runat="server" TargetControlID="txtFromDate"
Format="dd/MM/yyyy" OnClientDateSelectionChanged="verifyDate">
Rajesh BPosted Aug 2, 2013, 4:13 AM
Iftikar HussainPosted Aug 2, 2013, 3:07 AM
{
Response.Write("you can't insert record with previous date");
}
in javascript
Regards,
Iftikar
Hardik PatelPosted Aug 2, 2013, 3:03 AM
i am looking for asp.net
Hardik PatelPosted Aug 2, 2013, 2:59 AM
you got my point n it's work fine..
Iftikar HussainPosted Aug 2, 2013, 1:59 AM
Are you looking for in ASP.NET or Windows Form?
in windows form if you are using DateTimePicker control, then you can restrict the user by setting the property.
Other wise try like this
{
Response.Write("you can't insert record with previous date");
}
Regards,
Iftikar