1

I have two fields; one is normal text box used to generate system current date and the another field is <sharepoint :datetime control >

I need to validate this two: the date selected in SharePoint datetime control is not less than the date generated in text box.

Can anyone help me out?

2

You can go to

List Settings -> Validation Settings

Mention there the validation you want, something like

[X_Date] > [Created]
0

You can also use Asp:CompareValidator object instead of javascript. See sample code below

<SharePoint:DateTimeControl runat="server" ID="txtFrom" DateOnly="false" />
<SharePoint:DateTimeControl runat="server" ID="txtEnd" DateOnly="false" />
<asp:CompareValidator ID="cv" runat="server" Display="Dynamic" ForeColor="red" Type="Date" Operator="GreaterThanEqual" ControlToCompare="txtFrom$txtFromDate" ControlToValidate="txtEnd$txtEndDate"><img src="/_layouts/images/info16by16.gif"/> End Date should be more than Start Date</asp:CompareValidator>

Hope this helps you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.