Tuesday, November 6, 2012

SharePoint DateTimeControl validation



Here i am explaining how to validate a sharepoint datetime control with asp.net required field validator.

Datetime control is a very easy to use but internally it is having a drawback of required validation property.

It has a property called IsRequiredField But it will not work for date format validation when you are working with Visual web parts or web parts.

For this we have to use classical ASP.NET required field validator to validate control

Internally the DateTimeControl of SharePoint is just a calendar dropdown and a text box. Also, they already implemented a simple required field validation by just using the IsRequiredField property.

However, if you try to put an asp.net validator (i.e.: CompareValidator, RegularExpressionValidtator, etc…) on it, it says it can’t find the control. This is happening because the DateTimeControl is just a wrapper around this textbox and if you set the Validator ControlToValidate property to the DateTimeControl it isn’t smart enough to know to really validate against the actual textbox

Here is the way you need to define

  






NOTE : Here ControlToValidate property you need to set as {DateControlID}${DateControlID}Date then only it will work otherwise it will through error

Thank you !!!




11 comments:

  1. Given so much information in it. its very useful .perfect explanation about Dot net framework.Thanks for your valuable information. dot net training in chennai velachery | dot net training institute in velachery

    ReplyDelete
  2. It is really a great work and the way in which u r sharing the knowledge is excellent.Thanks for helping me to understand basic concepts. As a beginner in Dot Net programming your post help me a lot.Thanks for your informative article.. dot net training and placement in chennai | best dot net training in chennai

    ReplyDelete
  3. The knowledge of technology you have been sharing thorough this post is very much helpful to develop new idea. here by i also want to share this.
    Digital Marketing Training in Chennai

    Digital Marketing Training in Bangalore

    digital marketing training in tambaram

    digital marketing training in annanagar

    ReplyDelete
  4. Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
    full stack developer training in annanagar

    full stack developer training in tambaram

    full stack developer training in velachery

    ReplyDelete
  5. This is an awesome post.Really very informative and creative contents. These concept is a good way to enhance the knowledge.I like it and help me to development very well.Thank you for this brief explanation and very nice information.Well, got a good knowledge.
    Blueprism training in Pune

    Blueprism online training

    Blue Prism Training in Pune

    ReplyDelete
  6. Were a gaggle of volunteers as well as starting off a brand new gumption within a community. Your blog furnished us precious details to be effective on. You've got completed any amazing work!
    java training in chennai

    java training in marathahalli | java training in btm layout

    ReplyDelete
  7. Really great post, Thank you for sharing This knowledge.Excellently written article, if only all bloggers offered the same level of content as you, the internet would be a much better place. Please keep it up!

    angularjs-Training in sholinganallur

    angularjs-Training in velachery

    angularjs Training in bangalore

    angularjs Training in bangalore

    angularjs Training in btm

    ReplyDelete
  8. Whoa! I’m enjoying the template/theme of this website. It’s simple, yet effective. A lot of times it’s very hard to get that “perfect balance” between superb usability and visual appeal. I must say you’ve done a very good job with this.


    AWS Training in Bangalore | Amazon Web Services Training in bangalore , india

    AWS Training in pune | Amazon Web Services Training in Pune, india

    AWS Training in Chennai|Amazon Web Services Training in Chennai,India



    aws online training and certification | amazon web services online training ,india

    ReplyDelete