Thursday, 15 July 2010

c# - Validate asp.net calendar date is in future using asp.net validators -



c# - Validate asp.net calendar date is in future using asp.net validators -

so want utilize comparevalidator create sure asp calendar objects selected date date in future. i'm not sure how this, have far. when seek though tells me can't validate calendar object?

.aspx code:

<asp:comparevalidator id="validateeventdate" controltovalidate="calendar1" operator="greaterthanequal" type="date" runat="server" errormessage="can't pick date in past"> <asp:label id="eventdate" forecolor="black" runat="server" text="select date"></asp:label> <asp:calendar id="calendar1" runat="server" onselectionchanged="calendar1_selectionchanged" backcolor="#ff0000"></asp:calendar> <br />

here code behind:

protected void calendar1_selectionchanged(object sender, eventargs e) { validateeventdate.valuetocompare = datetime.now.tostring("dd/mm/yyyy"); }

any ideas how implement this?

look @ question: calendar custom validator standard validators aren't useful calendar control.

c# asp.net calendar validation

No comments:

Post a Comment