[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

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

Posted on 2007-11-16
7
Medium Priority
?
3,268 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
Technology Partners: 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

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

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…
When using a search centre, I'm going to show you how to configure Sharepoint's search to only return results from the current site collection. Very useful when using Office 365 with multiple site collections.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

649 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