Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

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

HomeHomeUsing DNN Platf...Using DNN Platf...Using Modules a...Using Modules a...DAL2 MVC Template errorDAL2 MVC Template error
Previous
 
Next
New Post
5/29/2017 1:08 AM
 

I'm new to DNN MVC, not totally new to MVC overall.

I had to hack this code to get the module to load without an error.  How could Model.Count() not exist as a method?

Error: FirstDALMVC 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_FirstDALMVC_Views_Item_Index_cshtml.Execute() in d:\DNNSites\DurthalerTechSvcs\DNN8\Website\DesktopModules\MVC\FirstDALMVC\Views\Item\Index.cshtml:line 8 at System.Web.WebPages.WebPageBase.ExecutePageHierarchy() at System.Web.Mvc.WebViewPage.ExecutePageHierarchy() at System.Web.WebPages.StartPage.ExecutePageHierarchy() at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) at DotNetNuke.Web.Mvc.Framework.ActionResults.DnnViewResult.ExecuteResult(ControllerContext context, TextWriter writer) at DotNetNuke.Web.Mvc.MvcHostControl.RenderModule(ModuleRequestResult moduleResult) at DotNetNuke.Web.Mvc.MvcHostControl.OnPreRender(EventArgs e) --- End of inner exception stack trace ---

Created the project from the DNN 8/9 DAL2 MVC Template.  It is in DesktopModules / MVC folder BTW.  Filled out Chris' Wizard.  Built the module.  Installed from a manifest in Host.  Originally, line 8 of the Index.cshtml threw an exception, which was the bold line below.

Found another article that said to build and zip the module and install it via a Zip upload in Host Extensions.  But I found I had to comment out a couple component lines in the manifest file.  It's looking for a resources zip file that doesn't exist and also was looking for the project DLL in the install folder.  Heck, the DLL built to the /bin folder in the website.  The component entry in the manifest does have the location as 'bin' but no syntax is there to specify to look from the website root.  I could get the module to load, same error however.  BTW, made sure per this article to build in release mode via the config manager.

Has to be my error, some missing config step but I've followed the procedures line by line to create the project.

I looked at the definition for the model type, nothing jumps out as to what would cause the line below to blow up.  I'm running DNN 08.00.04 (226), Windows 10, .Net 4.6, using Visual Studio 2015 Professional Trial version.

Looked over the critical updates.  I don't see anything in this list that if missing, could cause the error.

Critical Updates:

Index.cshtml code that blows up:

@inherits DotNetNuke.Web.Mvc.Framework.DnnWebViewPage<IEnumerable<Durthaler.Modules.FirstDALMVC.Models.Item>>

@using System.Text.RegularExpressions

@using DotNetNuke.Web.Mvc.Helpers

<div id="Items-@Dnn.ModuleContext.ModuleId">

@*@if (Model.Count() == 0)*@ <-- here the error was that Model had no Count method.  So commented it out.

@if (0 == 0)

{

<p>@Dnn.LocalizeString("NoItems")</p>

}

else

{

<ul class="tm_tl">

@foreach (var item in Model)<-- Obviously Model exists or the loop would break.

{

<li class="tm_t">

<h3>@item.ItemName</h3>

<div class="tm_td">@item.ItemDescription</div>

@{

if (Dnn.ModuleContext.IsEditable)

{

<div>

<a href="@Url.Action("Edit", "Item", new {ctl = "Edit", itemId = item.ItemId})">@Dnn.LocalizeString("EditItem")</a>

<a href="@Url.Action("Delete", "Item", new {itemId = item.ItemId})">@Dnn.LocalizeString("DeleteItem")</a>

</div>

}

}

</li>

}

</ul>

}

</div>


 

 
New Post
5/29/2017 3:13 AM
 

There is no way to edit one's post once they log off.  

 This is very confusing once you use Christoc's Wizard:  When creating a project using this template, you should have named your project simply "ModuleName", not "FirstDALMVCModuleName". If you didn't do this, the easiest thing to do is close the solution, delete the folder from your DesktopModules folder, then create a new project --  This comes up even if one would put in Module Name.  The substitution of one's module name correct or not is subject to the same logic.  So right off a developer has to ask himself what's up.  This is not good.

Also, the error I'm getting might be due to the project name.  The only error that shows up with a red squiggle is the one involving line 8 if(ModelCount() == 0).  Since this is the only squiggle one thinks it's the only error.  I finally looked at the error window.  The first error is actually on line 1 of the same file but it has no red squiggle:  The type or namespace name 'Linq' does not exist in the namespace 'System' (are you missing an assembly reference?) DesktopModules\MVC\FirstDALMVC\Views\Item\Index.cshtml.  The line of code is: @inherits DotNetNuke.Web.Mvc.Framework.DnnWebViewPage<IEnumerable< Christoc.Modules.FirstDALMVC.Models.Item >>.  This time I took the defaults.  The dot referencing isn't any different from what mine was.

I think the error is caused by the @inherits line being fouled up, since the IEnumberable type is what Model.Count() references.  The error on the line of code where Model.Count() is this: 'IEnumerable<Item>' does not contain a definition for 'Count' and no extension method 'Count' accepting a first argument of type 'IEnumerable<Item>' could be found (are you missing a using directive or an assembly reference?)

Well, the item type is this interface.

With the first line of the documentation page reading as it does, is there an error with the namespace?  The directions are totally not clear.  Since the substitution happens no matter what, the temptation is to blow the warning off.

How is the namespace supposed to read, then?

 
New Post
5/29/2017 11:00 AM
 

This is not an answer.  Disregard the post, too confusing.  I'm restarting from scratch.

 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Using Modules a...Using Modules a...DAL2 MVC Template errorDAL2 MVC Template error


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.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out