Try our conversational search powered by Generative AI!

Access a checkboxlist inside a PropertyControl

Vote:
 
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; } }
#15819
Oct 10, 2007 15:16
Vote:
 
Hi, A quick question, Why do you need it? Regards, Tibi
#16429
Oct 16, 2007 11:24
Vote:
 
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(); } }
#16430
Oct 16, 2007 15:33
Vote:
 
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.
#16431
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.