?
Solved

How do I tell if the Sharepoint PeopleEditor control is blank or valid

Posted on 2007-11-16
7
Medium Priority
?
3,237 Views
Last Modified: 2010-04-21
Hello All -
I'm using C#.

I'm using the PeopleEditor control from Sharepoint. On a button submit, I'm trying to see if PeopleEditor is blank and if it is a valid name .

Thanks for any help in advance.


//Here is my code
//In my aspx file:
<SharePoint:PeopleEditor id="peopleEditor" runat="server" IsValid="true" AllowEmpty="false" Height="20px" Width="200px" BackColor="Cornsilk" AllowTypeIn="true" MultiSelect="false"></SharePoint:PeopleEditor>
//In the aspx.cs file
Microsoft.SharePoint.WebControls.PeopleEditor PE1 = (PeopleEditor)Form.Controls[i].FindControl("peopleEditor");
if (PE1. ) // I need to find out if PE1 is blank and/or Invalid //
{
    ErrorMsg.msg = ErrorMsg.msg + "Contact Name " + @"\n";
    valRO_CN.Visible = true;
}
else
{
    valRO_CN.Visible = false;
}

Open in new window

0
Comment
Question by:JordanBlackler
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
7 Comments
 

Author Comment

by:JordanBlackler
ID: 20301746
After messing around, this code works, but there has to be something else that makes more sense.
if the name is InValid or blank the lengh equals zero.
Int32 intLength = PE1.CommaSeparatedAccounts.Length;
            if (intLength == 0) 
            {
 
                ErrorMsg.msg = ErrorMsg.msg + "Contact Name (Requesting Office)" + @"\n";
                valRO_CN.Visible = true;
            }
            else
            {
                valRO_CN.Visible = false;
            }

Open in new window

0
 

Author Comment

by:JordanBlackler
ID: 20301783
I also need to know what the value is,
0
 
LVL 15

Accepted Solution

by:
liebrand earned 2000 total points
ID: 20301820
Try this...
ArrayList entities = PE1.ResolvedEntities;
foreach (object entity in entities)
{
   PickerEntity pickerEntity = (PickerEntity)entity;
   string accountName = pickerEntity.Key;
   string displayName = pickerEntity.DisplayText;
   // pickerEntity.EntityDate[] has other values like first name, last name, etc you might be interested in.
}

Open in new window

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:JordanBlackler
ID: 20301868
Thats great, thanks a lot.
Do you where can i find information on this. I looked all over the web and i couldn't find a thing.
0
 
LVL 15

Expert Comment

by:liebrand
ID: 20301890
Unfortunately not -- I kind of had to figure that out on my own using things like the debugger.  However, I try to update the community pages on MSDN as much as I can (http://msdn2.microsoft.com/en-us/library/microsoft.sharepoint.webcontrols.entityeditor.updateentities.aspx -- see community edit below) when I find out how to do something that is not documented very well.

I'll try to get around to do it for this question as well.
0
 

Author Closing Comment

by:JordanBlackler
ID: 31409660
Thanks
0
 

Author Comment

by:JordanBlackler
ID: 20301907
thanks for the help
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question