Try our conversational search powered by Generative AI!

Error returning View to Dashboard gadget

Vote:
 

Hi,
I'm developing a dashboardgadget for EPiServer 7 but have run in to problems when trying to return a list to the default View (Index) as described in: http://world.episerver.com/Documentation/Items/Developers-Guide/EPiServer-Framework/7/OnlineCenter/Developing-Gadgets/ 

Returning content works fine: 

return Content("Test");

but when trying for exampel:

return View(myList);

The dashboard gadget only displays: "Sorry, an error occurred". The problem remains the same trying any type of combination of returning empty Views, typed View vs. non-typed View etc. Any ideas?

 

#77056
Nov 07, 2013 11:23
Vote:
 

Do you get any 500 error message back from the server? (usually there is an error in the view). Try running it with the console open or using a proxy tool like Fiddler.

Frederik

#77058
Nov 07, 2013 11:56
Vote:
 

I'm getting these errors in the console:

A first chance exception of type 'System.InvalidOperationException' occurred in System.Web.Mvc.dll
A first chance exception of type 'System.InvalidOperationException' occurred in System.Web.Mvc.dll
A first chance exception of type 'System.InvalidOperationException' occurred in System.Web.Mvc.dll
A first chance exception of type 'System.InvalidOperationException' occurred in System.Web.dll
A first chance exception of type 'Microsoft.Samples.Runtime.Remoting.Channels.Pipe.PipeIOException' occurred in EPiServer.Scheduler.dll
The thread 'PipeServerChannel.ServerMain' (0x674) has exited with code 0 (0x0).

No 500 error as far as I can see. 

I've tried to strip the View so currently nothing is going on there. But the error still occurs...

EDIT: There's actually an 500 error and it seems that it can find the view (Index). I created it as a partial view as described in the article I linked in my intial post. But maybe there's something wrong there anyway...:)

 

#77062
Edited, Nov 07, 2013 12:43
Vote:
 

Could you double-check using Fiddler? In my experience Chrome's console window doesn't always show all errors (while Firefox's is better).

You could also enable compilation of your views during build to see if you get any build errors.

Frederik

#77063
Nov 07, 2013 12:48
Vote:
 

Did the double-check just now (updated my previous reply)... :)

#77064
Nov 07, 2013 12:51
Vote:
 

Ok, great. You should be able to see the stack trace in the 500 response. Good luck.

Frederik

#77065
Nov 07, 2013 12:53
Vote:
 

Yes! Thanks for the help so far :)

 

#77066
Nov 07, 2013 12:56
Vote:
 

Hmmm this obiously goes beyond my understanding. This is the exception:

Exception Details: System.InvalidOperationException: The view 'Index' or its master was not found or no view engine supports the searched locations. The following locations were searched:
/modules/TSSocialMediaStats/Views/SocialMediaStats/Index.aspx
/modules/TSSocialMediaStats/Views/Shared/Index.aspx
/modules/TSSocialMediaStats/Views/SocialMediaStats/Index.ascx
/modules/TSSocialMediaStats/Views/Shared/Index.ascx
~/Views/SocialMediaStats/Index.aspx
~/Views/SocialMediaStats/Index.ascx
~/Views/Shared/Index.aspx
~/Views/Shared/Index.ascx
~/Views/SocialMediaStats/Index.cshtml
~/Views/SocialMediaStats/Index.vbhtml
~/Views/Shared/Index.cshtml
~/Views/Shared/Index.vbhtml

  The View IS in ~/Views/SocialMediaStats/Index.ascx. Setting the build action for the View to "Embedded Resource" doesn't help.

#77068
Nov 07, 2013 13:17
Vote:
 

Do you have a viewstart.cshtml defined somewhere? Try adding:

@{
    Layout = null;
}

To your view.

Frederik   

#77070
Nov 07, 2013 13:29
Vote:
 

Ok. some steps forward :)

As described in the article I created a separate project for my Dashboard gadget and pointed the location for this project to: MyWebsiteFolder\Public. Building and running still gives the error described above. BUT! If I manually copy(!) my View (MyWebsiteFolder\Public\Views\SocialMediaStats\Index.cshtml) to MyWebsiteFolder\Views\SocialMediaStats\Index.cshtml everything runs OK.

However, I presume that this can not be the preffered way of doing this? Am I missing some step or have I misinterpreted the instructions given in the article?

 

#77086
Edited, Nov 07, 2013 17:02
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.