Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesMVC module GetItems not returning valuesMVC module GetItems not returning values
Previous
 
Next
New Post
9/6/2016 2:15 AM
 
Hello, I have created an MVC Module. In that module I have created StudentController, StudentManager, Student Model.  The model has First Name, Last Name, address and so forth.  When I install my module it works fine, I can add items. The issue I am having is that as soon as I add an item I get the following error: "Error: MVCModule1 is currently unavailable. DotNetNuke.Services.Exceptions.ModuleLoadException: Value cannot be null. Parameter name: source ---> System.ArgumentNullException: Value cannot be null. Parameter name: source at System.Linq.Enumerable.Count[TSource](IEnumerable`1 source) at ASP._Page_DesktopModules_MVC_MVCModule1_Views_Student_Index_cshtml.Execute() in c:\websites\dnndev.me\DesktopModules\DNNModules\MVCModule1\Views\Student\Index.cshtml:line ". After debugging I see that function GetItems()  from the StudentManager is returning null. When I delete the row in the database the module works fine, but when I try to add a new student I still get the same error. I have try to find out why GetItems returns null when there is a row in the database.

 

public IEnumerable<Student> GetItems(int moduleId)
        {
            IEnumerable<Student> t;
            using (IDataContext ctx = DataContext.Instance())
            {
                var rep = ctx.GetRepository<Student>();
                t = rep.Get(moduleId);
            }
            return t;
        }

 

I have uploaded my code here

 

Thank you for your help...
 
New Post
9/8/2016 9:42 PM
 
Resolved
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesMVC module GetItems not returning valuesMVC module GetItems not returning values


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.

Content Layout

Subscribe to DNN Digest

Subscribe to DNN Digest

DNN Digest is our monthly email newsletter. It highlights news and content from around the DNN ecosystem, such as new modules and themes, messages from leadership, blog posts and notable tweets. Keep your finger on the pulse of the ecosystem by subscribing.  


Copyright 2017 by DNN Corp Terms of Use Privacy
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out