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 is it possible to use a dotnetdatasource and access the umbraco context?
i'd like to list all document types in my CMS.
You should be able to use UmbracoContext.Current in your .NET datasource.
thank you, perfect! for purpose of completeness - i did the following:
public class DocumentTypeDotNetDataSource : IDotNetDataSource
public IEnumerable<KeyValuePair<string, string>> GetEditorDataItems(int contextId)
.OrderBy(d => d.Name)
.Select(doctype => new KeyValuePair<string, string>(doctype.Alias, doctype.Name))
I'm a bit confused ? In the code you posted you still use the content service ?
PS : Never mind. You need all doctypes..so you actually needed them then ContentTypeService. Maybe add some caching so you don't need to get them every time from the database.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted