I have three text StartTextbox and EndTextBox ,Textbox3 .Please careful textbox3(No of month). Now I want difference of start date and end date is Checked by No of Months .

Here function in customvalidation
protected void ValidateDuration(object sender, ServerValidateEventArgs e)

   {
        DateTime start = DateTime.Parse(StartTextBox.Text);
        DateTime end = DateTime.Parse(EndTextBox.Text);


        int months = (end.Month - start.Month) + 12 * (end.Year - start.Year);

        e.IsValid = months <=TextBox3;
    }

You may store the diff of two datetime object values using TimeSpan structure.

Timespan diff=end-start;

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.