<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Controls</title><link>https://www.infopathdev.com:443/forums/43.aspx</link><description> </description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Limiting the Contact Seletor control for selecting only 1 user</title><link>https://www.infopathdev.com:443/forums/thread/29502.aspx</link><pubDate>Thu, 19 Jun 2008 13:18:57 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:29502</guid><dc:creator>mehtavipulk</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/29502.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=43&amp;PostID=29502</wfw:commentRss><description>&lt;span&gt;&lt;/span&gt;&lt;span&gt;
&lt;p align="left"&gt;&lt;font face="Arial" size="2"&gt;Hi,&lt;/font&gt;&lt;/p&gt;
&lt;p align="left"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;How do I limit the Contact Selector control so the user can only select a single person?&lt;/p&gt;
&lt;p align="left"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p align="left"&gt;I referred to the below blog, but when&amp;nbsp;I remove the second users is, the error&amp;nbsp;(with the red border) still persists&lt;/p&gt;
&lt;p align="left"&gt;&lt;a title="http://blogs.msdn.com/infopath/archive/2007/02/28/using-the-contact-selector-control.aspx" href="http://blogs.msdn.com/infopath/archive/2007/02/28/using-the-contact-selector-control.aspx"&gt;http://blogs.msdn.com/infopath/archive/2007/02/28/using-the-contact-selector-control.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p align="left"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p align="left"&gt;I have implemented below code for limiting the control&lt;/p&gt;
&lt;p&gt;public void group1_Validating(object sender, XmlValidatingEventArgs e)&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;if (e.Operation == XmlOperation.Insert)&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; if (e.Site.SelectChildren(XPathNodeType.Element).Count &amp;gt; 1)&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; e.ReportError(e.Site, false, &amp;quot;User Selection Error!&amp;quot;, &amp;quot;Only 1 user can be selected!&amp;quot;);&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p align="left"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p align="left"&gt;Is there any issue with the code?&lt;/p&gt;
&lt;p align="left"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p align="left"&gt;&amp;nbsp;Regards,&lt;/p&gt;
&lt;p align="left"&gt;Vipul Mehta&lt;/p&gt;&lt;/span&gt;</description></item></channel></rss>