.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Auto populate custom fields with values based on user selected in People Editor

Posted By:      Posted Date: April 10, 2011    Points: 0   Category :C#


I have a requirement wherein I want to populate the currently logged in user in people editor field of my custom web part and based on the user in people editor field, Also I should be able to select any other user if needed. I need to fill some other custom fields as well. I am able to get this quite easily. But suppose I remove the current logged user's name from people editor and enter some other name and then click on Check Names, then how do I change the custom fields based on the new user ?

    PeopleEditor peNameofFileRequestor = new PeopleEditor();
    TextBox txtPhoneNumber;
    TextBox txtDepartmentName;
    SPContext cnxtCurrent;

    protected override void CreateChildControls()

      cnxtCurrent = SPContext.Current;
      SPUser usrCurrent = cnxtCurrent.Web.CurrentUser;

      peNameofFileRequestor.MultiSelect = false;
      peNameofFileRequestor.SelectionSet = "User";
      peNameofFileRequestor.AutoPostBack = true;

      System.Collections.ArrayList entityArrayList = new System.Collections.ArrayList();
      PickerEntity entity = new PickerEntity();
      entity.Key = usrCurrent.LoginName;
      entity = peNameofFileRequestor.ValidateEntity(entity);

      Hashtable htEntityDa

View Complete Post

More Related Resource Links

Custom Columns - Fill values based on value selected in a lookup column



I am working with Sharepoint 2007. I have a list of 130 buildings located in six different cities and three different provinces. I imported this list from an Excel spreadsheet. I also have a document library that contains various files associated with these buildings. I've added a custom column to the document library that contains a lookup field to the name of each building. I also have two additional custom columns that have the city and province. What I would like to accomplish is to have the city and province columns automatically be set based on the name of the building selected, such that these values are taken from the same row of this list as the building name.

Hopefully my question makes sense.

Thank you, James

How to populate 2 custom list fields from one selection in a 'people or groups' selection


Hello everyone, I'm new to the forums.

I need to create a custom list that has the fields:

  • Name (get by People or groups - searched via e-directory)
  • Job Title
  • Picture

Now I want Job title to be auotimatically filled in depending on what name the user selected from the first option.  The actual date in e-directory already has the person's job title, so it seems resonable to me that when the user chooses the person they want to add, the person's job title automatically fills in a field.  However, I can't seem to be able to do that.  I created the Name field then when I went into the Show Field drop down, it had several options including telephone number, surname, job title.  I then selecvted which I wanted to show.  Is there a way to create another field that the user doesn't see that then is populated with the the job title, info which is otained from whatever name was selected?

Phew, sounds complicated, I know!

Also, In the picture field, I selected the field type as url/image, then selected show link as image.  But what I would prefer would be the option for the user to be able to browse the site, or their computer for the image file.  Currently, the user has to know the url for where the image is stored in a document library.

Any suggestions would be grateful

How do you create a custom BDC data field that allows for multiple selected values?

I need help creating a custom data field using the BDC column as a base.  We need to allow for multiple selected values instead of just a single one.  I can't find anything on the net which shows how to do this.

Values in user control fields empty when AutoEventWireup=true ?

As a BizTalk developer I'm trying to build a ASP.NET website so some obvious things might be new to me (so please be gentle). I have a web form and I have a user control on it. This user control contains a panel with some user properties that are to be stored in a database. So far nothing fancy. The user control itself contains a panel and is working fine (all code to retrieve and store the values is working). I used the default settings of creating a user control and one of them was AutoEventWireup=true. This works fine because I also have some dropdown boxes (and other fields) that need to be filled with values from the database and that happens in the Page_load event. The panel specifies the 'DefaultButton' which calls a method when clicked to save the values after the user has changed them. On this click the code of the method is called, I confirmed that, but I found out that the values of my controls on the user control (for example the Textbox control) are empty. As a non-ASP.NET developer I couldn't figure out why. So I changed some settings like AutoEventWireup to false. Off course this resulted in my dropdown boxes no longer to be initially filled, but my surprise was big to find out my controls actually contained the values the user typed in. Logically I need both the values and th

How do you add duplicate fields to a SSRS custom report and receive differtent output values.

I have built a custom report in SSRS 2008 using fields for supplier and customer.   I have added a Parent Row Group using the Supplier field for the group expression and used the Customer Details as my child details group. This returns a list of all customers for each supplier.   (Supplier | = Customer details ( Name, Dob etc.)   How would I add an additional Supplier field to the customer details returning only values for other Suppliers used by a customer, not the value of the Supplier listed in the Parent Group?

bind values for the drop down based on people picker value change

hi, i have a two lists in my sp. list 1 name  items user1 item1 user1 item2 user2 item1   and list 2 is in this way in this i have a people picker and a drop down when ever i change the name in people picker the value should get filled from list 1 and fill in drop down list so i need to get the on text changed event of people picker and bind it in the dropdown list could some help me out in fixing thisjayaraja

bind values for the drop down based on people picker value change

hi, i have a two lists in my sp. list 1 name  items user1 item1 user1 item2 user2 item1   and list 2 is in this way in this i have a people picker and a drop down when ever i change the name in people picker the value should get filled from list 1 and fill in drop down list so i need to get the on text changed event of people picker and bind it in the dropdown list could some help me out in fixing thisjayaraja

Is there a way in VB.Net to embed a custom user control to a web page based on Word or Excel

Hi Everyone.  I'm looking to create a web page that would be used on a local intranet that would use a custom control based on Word and Excel.  I've used code previously to embed it in a Windows application but wasn't sure if anyone knew of any examples out there on how to embed a custom control into a ASP.Net page.

Using Rules to populate a textbox based on other values.


I am building a web-friendly form in Infopath (little new to the software)...

I have been able to hook up my form to my SharePoint and pull in user data so I can pre-populate various fields.

One field is not in our Profile services (nor Active Directory).  I'll call it Company Code.

But you can determine Company Code by checking the Company and Department.

Something like:

Company = "ABC", Department = "123" then Code = "XCV"
Company = "ABC", Department = "456" then Code = "VCX"


Since I am successful pulling the Company and Department from the Webservice.

I figured I build a text-box and put 30 or so rules on it to analyze the contents of Company and Department to determine what should be in the text-box.
So I used Conditions to check the Comany and Department and then the rule set the contents of the Company Code box.

However it seems as though the rules never run. 

And I got to thinking, when DOES the rule know when to run?  I don't see an "onchange" event or anything (trying to avoid code for web-friendly anyways) - so....

I do have the Company and Department fields populate immediately when the form is opened, but is that early enough for the rules?

Do the rules have to manually tri

Issue using Managed Metadata with custom fields in the User Profiles application


Hi there,

I've created several custom properties in my User Profile Application.

I've also created several Term Sets in the Managed Metadata service application Term Store for use with these custom properties. Some of the Term Sets contain terms and have a closed submission policy whilst others have an open submission policy.

If the user hasn't already populated any of these custom fields in their profile, when they click on the Edit My Profile link from their My Site Profile page everything seems okay (for the first time).

The user is then able to successfully select values for these custom fields - the metadata is available. They can click on the "tag" icon to select values, or start typing and the suggestions appear. They are also able to enter new values into custom property fields where the term set is open to submission.

If they then Save and Close then go back into Edit My Profile, often not all of the existing data is populated in the metadata custom fields. On different occasions different fields may be blank. Sometimes this is accompanied by the error "Message from webpage / The server method 'ValidateTerms' failed", but not always.

Has anyone else tried this or have any suggestions are to what the issue might be?

Thanks in advance.

Custom Workflow won't auto start, but only for one user.


Hi, I have a custom worklfow which is associated with a list.  The workflow is set to auto start when a new item is added to the list.  This happens fine for every user in my organisation, but not for one particular user.  When he submits a new item to the list, nothing happens. The Workflow just will not start.  There are no errors in the log and no attempt is made to start the workflow.  The user is part of a SharePoint group which has contirbute (no delete) permission on the list, just like everyone else in that group who works fine. 

This user also is having problems progressing the workflow, if I start the workflow for him and assign it to him.

The workflow above, manages a CR process, creating tasks for users, taking their responses from custom task forms and populating a CR document held in a document library.  The first step for a user is to fill in a task form which when submitted, sets the task to 100% complete, then populates the CR document with the text the user entered.  Once the task is at 100%, the workflow process is looking for this, closes the task and creates a new task for an approver.  The problem for this same is user is that, the task gets set to 100%, but the CR doesn't progress.  Again, no errors are shown, but the tp_workflowversion value in the userdata table in the content datab

SQL searches based on user selectable fields


This is the second time I've searched on this and came up not fully understanding why this isn't possible. Say you have one text box, but you want to be able for a user to search by "company name,"  "job number," or "Order No," So you put one text box and a drop down list where the user can select what field to search.

Here is what I would like to do  Select [order_no], [job_no], [company_name] From [order_tbl] WHERE @var1 Like '*@var2*'  (maybe not totally correct syntax, but you get the picture....and @var1 is set from the selection of the dropdownlist and @var2 is set from the text box).

What I do now is three separate SQL statements. If DropDownlist1.SelectedValue = 1 then do, if it = 2 then do, etc.

But when you have a large select statement with table joins, you have to make any changes three times, and it seems easy to make a mistake...not to mention if you have more than three choices, you have an SQL statement for each choice.

Am I misunderstanding that it isn't possible to do a variable field name so I can have one select statement to work with?  And if it isn't possible, I just wish I could wrap my head around why, because it seems such a simple thing to do.


Show/Hide fields on InfoPath based on context User Group Membership

I am reading a book on SharePoint 2010 Development by Wrox and although it is a good book, the InfoPath section is limited. I am Googling to see if I can find anywhere where i can perhaps have this type of functionality to hide and show a specific field based on their Group Membership?
Victor Palma

Populate fields from custom list..... Using Sharepoint Designer only



I have a custom list with all Active Directory user data in it......

(AD name / Email / Address / tel .... etc)


I then have a form that user can select their AD name, i want to populate the fields "Phone" + "Email"   etc....

from the custom list....


How do i do it ? using sharepoint designer only ??


Thanks Rob

Creating custom Intellisense-based text editor like Pex for Fun


We would like to create a custom text editor which allows our end users to enter .Net code that hooks into our .Net API with Intellisense similar to how it is done on the Pex for Fun website: http://www.pexforfun.com/

Is there a way to build a custom control text editor (or use a 3rd party free or purchased control) that supports .Net Intellisense  in the same way done by Microsoft on the Pex for Fun website?


How to search grid results based on user provided values?


I would like a user to be able to enter some criteria in a search box and then have them click on a search button to filter the data using a "contains" logic and not an exact match.

 Anyone know if this is possible?

I have downloaded the DynamicFilterRepeater and that works well, but you end up with one search box per colulmn...I would like to have one search box that columns could subscribe to and that would be filtered automatically.

Not sure how to go about doing something like that...I'm still quite new to DD and I am still trying to get a grasp on the basic stuff.


Create user control fields based on bound properties



I am creating a user control that I would like to be able to generate the form entry fields based on what custom data object the form is bound to. Basically, I have a drop-down box that allows the user to pick what type of data object they are working with (user, address, etc.) That choice will bind the user control to the related data object. No big deal there. I am stuck, however, on how to generate the form fields based on the properties of the object. I feel like I have seen examples of this in WPF but am not able to find them now. All form fields will be simple label, textbox combinations in a stackpanel.

I know more detial will probably be required. Let me know what specifically you would like to know. Any help of direction is greatly appreciated.



ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend