asp.net - check RadDateTimePicker value against current system date time value -


how can verify if selected datetime value raddatetimepicker greater current system datetime value in asp.net using server side validaton.

<telerik:raddatetimepicker runat="server" id="orderdate" >       <calendar id="calendar1" runat="server" enablekeyboardnavigation="true">         </calendar> </telerik:raddatetimepicker> 

to validate it, need use comparevalidator or customvalidator.

please use following markup datetime picker:

<telerik:raddatetimepicker runat="server" id="orderdate">    <calendar id="calendar1" runat="server" enablekeyboardnavigation="true">    </calendar> </telerik:raddatetimepicker> <asp:customvalidator id="cvorderdate" runat="server" controltovalidate="orderdate" validationgroup="vgsubmit" errormessage="please use correct date" onservervalidate="cvorderdate_servervalidate"></asp:customvalidator> 

code behind:

protected void cvorderdate_servervalidate(object source, servervalidateeventargs args) {   args.isvalid = orderdate.selecteddate.value > datetime.now; } 

there demo of raddatetimepicker validation here http://demos.telerik.com/aspnet-ajax/calendar/examples/datetimepicker/validation/defaultcs.aspx


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -