1

I have a PeopleEditor in my ASPX page:

<SharePoint:PeopleEditor ID="ccAuthor" runat="server" SelectionSet="User" MaximumEntities="1" />

And access its contents when the corresponding save button is clicked:

<asp:LinkButton ID="lnkUpdateCcAuthor" runat="server"
    OnCommand="LinkPostbackCommand"
    CommandName="UpdateCcAuthor" CommandArgument="">
    <asp:Image ID="imgCcAuthor" runat="server" ImageUrl="/_layouts/images/save.gif"
        style="border-width: 0px;" AlternateText="Update CC-Author for selected Task" />
</asp:LinkButton>

This works fine when adding people, but I cannot remove them.

This code

string[] accounts = editor_.CommaSeparatedAccounts.Split(',');

Executed upon the PostBack of the Update button always contains the account that was in the PeopleEditor initially, although the form control is empty when I click Update.

What is going on here? Why can't I remove the account?

4
  • Are the values manually removed from the people picker or removed through some other code?
    – NLV
    Nov 7, 2016 at 19:37
  • Manually as in highlighting/selecting the current account (mouse/shift+keyboard) and pressing backspace/delete to remove it.
    – F.P
    Nov 7, 2016 at 19:47
  • Hmm. That's weird. Looks like an odd issue. Did you check this?
    – NLV
    Nov 7, 2016 at 19:55
  • This could actually be. We are using Firefox and interestingly, even Sharepoint's native People Pickers don't work. It seems an internal Problem there somehow...
    – F.P
    Nov 9, 2016 at 12:16

2 Answers 2

0

There might below reasons that values are not getting cleared.

  1. are you binding people picker field on page load ? If so are you assiging value to it in if (!IsPostBack). This is necessary because it might be case that you page load is getting executed before you update click event and so your people picker contains account again which was assigned in page load. In this case you have to put your code of assigin value inside If condition of !IsPostBack so that this piece of code executed only on first time page load and not in post back.
  2. Is your update button inside ajax update panel ? Do whole page postback or just fraction of page ? If update panel is used you have to put your people picker control also inside Ajax Update Panel.
0

I had a talk with the customers and we decided to just circumvent the issue by having a "Clear" Button next to the picker and then clear it in the PostBack.

This way, we don't need extra JS / other Code and can always be sure that the clearing works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.