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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Sandeep Singh ShekhawatRank #147 · 15.6K reputationPosted Aug 1, 2013, 10:02 PM EDT
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">
Iftikar HussainRank #423 · 5.9K reputationPosted Aug 1, 2013, 9:59 PM EDT
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
Hardik PatelRank #4,439 · 343 reputationPosted Aug 1, 2013, 10:59 PM EDT
you got my point n it's work fine..
Hardik PatelRank #4,439 · 343 reputationPosted Aug 1, 2013, 11:03 PM EDT
i am looking for asp.net
Iftikar HussainRank #423 · 5.9K reputationPosted Aug 1, 2013, 11:07 PM EDT
{
Response.Write("you can't insert record with previous date");
}
in javascript
Regards,
Iftikar
Rajesh B31 reputationPosted Aug 2, 2013, 12:13 AM EDT