<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>moopoo.net &#187; Validation</title>
	<atom:link href="http://moopoo.net/tag/validation/feed/" rel="self" type="application/rss+xml" />
	<link>http://moopoo.net</link>
	<description>Fishing, technology and anything else</description>
	<lastBuildDate>Fri, 09 Dec 2011 11:04:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Validation Group with SharePoint DateTimeControl</title>
		<link>http://moopoo.net/sharepoint/validation-group-with-sharepoint-datetimecontrol/</link>
		<comments>http://moopoo.net/sharepoint/validation-group-with-sharepoint-datetimecontrol/#comments</comments>
		<pubDate>Tue, 16 Feb 2010 10:57:30 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[Validation]]></category>

		<guid isPermaLink="false">http://moopoo.net/?p=109</guid>
		<description><![CDATA[The SharePoint DateTimeControl has a property called IsRequiredField, which will act like a RequiredFieldValidator for the control. The problem is when working with web parts in SharePoint calling Page.Validate in your web part can have unexpected results. It often ends up firing validators elsewhere on the page, particularly if the web part is used on [...]]]></description>
			<content:encoded><![CDATA[<p>The SharePoint DateTimeControl has a property called IsRequiredField, which will act like a RequiredFieldValidator for the control. The problem is when working with web parts in SharePoint calling Page.Validate in your web part can have unexpected results. It often ends up firing validators elsewhere on the page, particularly if the web part is used on a list form for example.<br />
One answer of course is to use a validation group in your web part, this is where the DateTimeControl falls down as it doesn&#8217;t have this property.</p>
<p>The answer to this to create a validator in your webpart and hook it into the TextBox element of the DateTimeControl, which will then allow you to set the validation group on it.</p>
<p>To do this use the following code when you create your validator.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">valReviewDate.<span style="color: #0000FF;">ControlToValidate</span> <span style="color: #008000;">=</span> <span style="color: #FF0000;">string</span>.<span style="color: #0000FF;">Format</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;{0}${0}Date&quot;</span>, dteReview.<span style="color: #0000FF;">ID</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<p><a href="http://sharepointdata.blogspot.com/2009/06/sharepoint-datetime-control-validation.html">This post</a>, describes how to do it from code in front.</p>
]]></content:encoded>
			<wfw:commentRss>http://moopoo.net/sharepoint/validation-group-with-sharepoint-datetimecontrol/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

