Sharepoint People Editor within Update Panel - Cannot set value after partial postback

Posted by kalebd on Stack Overflow See other posts from Stack Overflow or by kalebd
Published on 2010-04-07T23:02:17Z Indexed on 2010/04/20 1:03 UTC
Read the original article Hit count: 691

Filed under:
|
|

trying to set default value in the people picker with an update panel. On a test page without an update panel, the code

PeopleEditor1.CommaSeparatedAccounts = "domain\\user.account";

works just fine. As soon as I add an update panel around that people editor the picker's text area gets cleared out and future calls to the above snippet are ignored. This can be reproduced by placing the following on a fresh aspx page w/ code-behind.

code-behind:

protected override void OnLoad(EventArgs e)
{
    base.OnLoad(e);
    PeopleEditor1.CommaSeparatedAccounts = "domain\\user.account";
}

aspx source:

<asp:ScriptManager runat="server" id="ScriptMan">
</asp:ScriptManager>
<asp:CheckBox runat="server" ID="causepostback" AutoPostBack="true" Text="Should this be checked?" />
<asp:UpdatePanel runat="server" ID="candypanel" UpdateMode="Conditional">
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="causepostback" />
    </Triggers>
    <ContentTemplate>
        <SharePoint:PeopleEditor runat="server" ID="PeopleEditor1" MultiSelect="true" 
                AllowEmpty="false" SelectionSet="User,SecGroup,SPGroup" AutoPostBack="false" 
                BorderWidth="1" Width="265px" PlaceButtonsUnderEntityEditor="false" Rows="1" />        
    </ContentTemplate>
</asp:UpdatePanel>

Your insight is appreciated.

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about c#