Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi!
I'm trying to add a new section by code but I can't get it to show:
public void Compose(Composition composition) { composition.Sections().Append<MySection>(); }
The section:
public class MySection : ISection { public string Alias => "mySection"; public string Name => "My Section"; }
The section gets added to the collection but nothing is rendered?
Any ideas why?
Thanks!
/Kristoffer
Hi Kristoffer,
By default, a new section won't display until you have added it to the list of visible sections for a user group.
If you go to the users' section, click on groups in the top right-hand corner
select administrators
and then add the section to the list,
save and then refresh the browser, the section should appear.
Programmatically.
you can add a section to a user group - (this would be a one off task) - something like :
private void AddSectionToGroup(string groupAlias, string sectionAlias) { var group = userService.GetUserGroupByAlias(groupAlias); if (group != null) { if (!group.AllowedSections.Contains(sectionAlias)) { group.AddAllowedSection(sectionAlias); try { userService.Save(group); } catch (Exception ex) { // oh dear :( it went wrong } } } }
Kevin
Thanks Kevin, works just perfect!
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
New section not showing
Hi!
I'm trying to add a new section by code but I can't get it to show:
The section:
The section gets added to the collection but nothing is rendered?
Any ideas why?
Thanks!
/Kristoffer
Hi Kristoffer,
By default, a new section won't display until you have added it to the list of visible sections for a user group.
If you go to the users' section, click on groups in the top right-hand corner
select administrators
and then add the section to the list,
save and then refresh the browser, the section should appear.
Programmatically.
you can add a section to a user group - (this would be a one off task) - something like :
Kevin
Thanks Kevin, works just perfect!
/Kristoffer
is working on a reply...