This project is read-only.

Fill category table data to combo box

Topics: Customizing Orchard
Nov 22, 2011 at 5:21 PM


I am creating module called article. Its directly work with articlepart table

But i want take categorypart table data to combobox .

i have tried following way


var Categories = Services.ContentManager.Query<CategoryPart, CategoryPartRecord>();

            var results = Categories
               .Slice(1, Categories.Count() )

            ViewData["CategoryID"] = results.Select(c => new SelectListItem
                Text = c.Name,
                Value = c.Id.ToString()


results  always null. I have use same code to my category module, its working there. why its not working to article module

i have created this two classes as category module
CategoryPart, CategoryPartRecord

Nov 22, 2011 at 6:54 PM

You mean you have copies of those classes in a separate module? Yeah, that would explain it.

Nov 23, 2011 at 4:52 AM

I have copy those classes from my category module

Nov 23, 2011 at 5:11 AM

You didn't say how it is not working.

Nov 23, 2011 at 5:34 AM

I think from article module its not pint to my physical database  table

I have copy my category module handler too. 


namespace eProp.Articles
    public class CategoryHandler : ContentHandler
        public CategoryHandler(IRepository<CategoryPartRecord> repository)

Nov 23, 2011 at 5:40 AM

You're still not explaining what the problem is.

Nov 23, 2011 at 6:33 AM

Problem is 

 var results = Categories
               .Slice(1, Categories.Count() )

results is always null in my article module. But category module it has data.

Nov 23, 2011 at 6:35 AM

Of course, if you are using a copy of the classes instead of a reference. They are not the same, so they have different storage.

Nov 23, 2011 at 8:34 AM

I have refrence category module. Now its working fine , thank u