Can’t Set PeopleEditor.CommaSeparatedAccounts

This is quirky but I believe I have figured it out: The other day I was trying to set a PeopleEditor’s CommaSeparatedAccounts attribute but it would not take my string. I debugged the code and actually witnessed with my own eyes the assignment of the new user string but then when I checked the attribute value it was still String.Empty(“”). So I had a hunch, tried this and it finally it took my username string and it darn well liked it:

bool isVisible = peUser.Visible;
                                    peUser.Visible = true;
                                    peUser.CommaSeparatedAccounts = ddlUserMatrixSelector.SelectedValue;
                                    peApprover.Visible = isVisible;

The moral of the story is control.visible must be true to set this attribute.

Advertisements

One thought on “Can’t Set PeopleEditor.CommaSeparatedAccounts

  1. Ah! You saved me! In my case the solution was a little more complicated. In my code I have a list of PeopleEditors inside a repeater. While the PeopleEditors were set to visible, the repeater was invisible during the databind. This prevented the PeopleEditor from accepting the CommaSeperatedAccounts. Now I have the repeater visible before the databind and all is working! Thanks! -Chaz

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s