Hi,
I've created an application page in which I'm using a Sharepoint People Editor control and a button control. The people editor control is autopopulated on the page load and the control is enabled or disabled based on the user permissions.
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
PeopleEditor1.CommaSeparatedAccounts = "MYDOMAIN\\user1,MYDOMAIN\\user2;";
bool IsAuthenticated = ValidateUser();
if (IsAuthenticated)
PeopleEditor1.Enabled = true;
else PeopleEditor1.Enabled = false;
}
}
protected void Button1_Click(object sender, EventArgs e)
{
string commaccs = PeopleEditor1.CommaSeparatedAccounts;
}
When the user visits this page, if he is a valid user, the people editor control is enabled, he can add more people into it and when he clicks the button, I'm able to read the new values from the
PeopleEditor1.CommaSeparatedAccount
s.
The problem here is that, if the user is not authenticated, the people editor control is disable, so that he cannot add new members, and when he clicks the button,
PeopleEditor1.CommaSeparatedAccounts
is just an empty string. The pre-populated values on the page load is missing from the control. I've tried all the combinations for
PeopleEditor1.EnableViewState
and
PeopleEditor1.ViewStateMode
to read the pre-populated values from the disabled control, but without success.
Apart from the people editor, there are some asp.net textboxes and dropdown lists which are pre-populated during page load, and are enabled/disabled based on user permissions (For code readability, I've removed them above). None of these are causing problems. Only with the people editor, I'm facing such problem.
Could anyone please help me in letting know what the problem could be and what would be the workaround for this? I wouldn't like to change the logic as many other controls are dependent on it and are working fine. Tried Google around it but without any great information. Any help is appreciated.
Thanks in advance.
RO..