Try our conversational search powered by Generative AI!

Access a checkboxlist inside a PropertyControl

In global.asax I need to access a checkboxlist which is inside a PropertyControl Global.asax: void Instance_PublishedPage(object sender, PageEventArgs e) { PageData nySide = EPiServer.DataFactory.Instance.GetPage(e.Page.PageLink); PropertyData pd = nySide.Property["Siderettigheter"]; //How can I get a handel to the Checkboxlist defind in the propertycontrol? } Code from the propertyControl: public class SideRettigheterControl : EPiServer.Web.PropertyControls.PropertySelectMultipleControlBase { public override void CreateEditControls() { base.CreateEditControls(); CheckBoxList CheckBoxRoles = this.EditControl; CheckBoxRoles.DataSource = Extras.Roles(); CheckBoxRoles.DataBind(); CheckBoxRoles.RepeatDirection = RepeatDirection.Vertical; } }
Oct 10, 2007 15:16
Hi, A quick question, Why do you need it? Regards, Tibi
Oct 16, 2007 11:24
The customer want to select among roles. If the role is checked, then every member whit this role must have read access to the document. If I get a handel to the checkboxlist then I can update the ACL whit this roles. I will then use this code: PageData CurrentPage = EPiServer.DataFactory.Instance.GetPage(e.Page.PageLink); AccessControlEntry ac = null; if (roles.Items[i].Selected) { if (!CurrentPage.ACL.Exists(roles.Items[i].Value)){ ac = new AccessControlEntry(roles.Items[i].Value, AccessLevel.Read, SecurityEntityType.Role); CurrentPage.ACL.Add(ac); CurrentPage.ACL.Save(); } }
Oct 16, 2007 15:33
Hi Robert! You probably don't need to have access to the checkboxlist in the event. Try extracting the value from the property and then split it: PropertyMultipleValue property = e.Page[Yourpropertyname]; if(property == null || String.IsNullOrEmpty(property.Value)) { return; } string roles = property.Split(','); foreach(string role in roles) { //Add role to acl here } //Save Acl Hope this will help you! Linus Ekström EPiServer Development Team ps. I typed the code freehand so it might have compilation errors. ds.
Oct 26, 2007 16:42
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.