Hi Everyone, Could any one please help me out in starting with setting up MVC website in Umbraco? I gone through several links but none of them explains how to start , please help?
Hi Deep. What i did was to create a umbraco site in inetpub. Create a class project in visual studio, which built the dlls to the bin of the inetpub project.
It's a package. Just install a blank (no starterkit and theme) Umbraco installation. If you have set up the blank Umbraco installation, then install the Standard Website MVC starterkit.
You can install a package via the Umbraco Backend in the Developer Section > Packages > Local Packages.
Hey guys, followed your advize and setup STandard MVC site on my Umbraco 6 installation.
Getting lot of error like
Compiler Error Message: CS1502: The best overloaded method match for 'string.IsNullOrEmpty(string)' has some invalid arguments
Source Error:
Line 8: foreach(var nodeId in nodeIds)
Line 9: {
Line 10: if(!String.IsNullOrEmpty(nodeId)) Line 11: {
Line 12: var publishedContent = Umbraco.NiceUrl(Convert.ToInt32(nodeId));
Compiler Error Message: CS1061: 'object' does not contain a definition for 'Split' and no extension method 'Split' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)
Source Error:
Line 33: {
Line 34: <ul class="navigation fc">
Line 35: @foreach (var item in Umbraco.TypedContent(homepage.GetPropertyValue("headerNavigation").Split(','))) Line 36: {
Line 37: <li><a href="@item.NiceUrl()">@item.Name</a></li>
You should try installing Ucomponents. I have noticed that the Standard Website uses a SW page picker, which is not working without Ucomponents and causes errors on some pages.
Hope that helps
EDIT: There is one fix you should make to the ContentPanels.cshtml partial view. At the moment it will throw an exception if no content panels are found on the page because it tries to split a 'null' element. Just replace the first code block on the cshtml file with:
@{
Layout = null;
List<IPublishedContent> panels = new List<IPublishedContent>();
var contentPannels = Model.GetPropertyValue<string>("contentPanels");
if (contentPannels != null)
{
var nodeIds = Model.GetPropertyValue<string>("contentPanels").Split(',');
foreach (var nodeId in nodeIds)
{
if (!String.IsNullOrEmpty(nodeId))
{
var publishedContent = Umbraco.NiceUrl(Convert.ToInt32(nodeId));
if (!String.IsNullOrEmpty(publishedContent) && publishedContent != "#")
{
panels.Add(Umbraco.TypedContent(nodeId));
}
}
}
}
}
Setting up MVC website
Hi Everyone, Could any one please help me out in starting with setting up MVC website in Umbraco? I gone through several links but none of them explains how to start , please help?
Hi Deependra,
The Standard Website MVC starterkit is a good starting point.
Hope this helps,
Anthony
Thanks Anthony for quick reply. There is no instruction given on website how to use this Standard Website MVC kit.
Could you please explain how to setup this?
Hi Deep. What i did was to create a umbraco site in inetpub. Create a class project in visual studio, which built the dlls to the bin of the inetpub project.
You should read this: http://umbraco.com/follow-us/blog-archive/2012/10/30/getting-started-with-mvc-in-umbraco-410.aspx
and this: http://our.umbraco.org/documentation/reference/mvc/
If you need any help give us a shout :). I would advise using surface controllers :). Charlie
Hi Deependra,
It's a package. Just install a blank (no starterkit and theme) Umbraco installation. If you have set up the blank Umbraco installation, then install the Standard Website MVC starterkit.
You can install a package via the Umbraco Backend in the Developer Section > Packages > Local Packages.
Hope this helps,
Anthony
Yea i would agree with Anthony, using the starter kit is the better way to start things off :)
There is also a complete Umbraco MVC website which just runs out of the box: http://24days.in/umbraco/2012/damp-gallery/
Jeroen
Thanks All, I got it runing .
Hey guys, followed your advize and setup STandard MVC site on my Umbraco 6 installation.
Getting lot of error like
Compiler Error Message: CS1502: The best overloaded method match for 'string.IsNullOrEmpty(string)' has some invalid arguments
Source Error:
Line 8: foreach(var nodeId in nodeIds) Line 9: { Line 10: if(!String.IsNullOrEmpty(nodeId)) Line 11: { Line 12: var publishedContent = Umbraco.NiceUrl(Convert.ToInt32(nodeId));
Source File: e:\UMBRACO\Umbraco6-test.tmp-cms.com\Views\Partials\ContentPanels.cshtml Line: 10
or:
Compiler Error Message: CS1061: 'object' does not contain a definition for 'Split' and no extension method 'Split' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)
Source Error:
Line 33: { Line 34: <ul class="navigation fc"> Line 35: @foreach (var item in Umbraco.TypedContent(homepage.GetPropertyValue("headerNavigation").Split(','))) Line 36: { Line 37: <li><a href="@item.NiceUrl()">@item.Name</a></li>
Source File: e:\UMBRACO\Umbraco6-test.tmp-cms.com\Views\SW_Master.cshtml Line: 35
And so far each time I am compensating one error - getting next one.
Any ideas what could be wrong if you have it up and running?
Thanks
Umbraco 6, Windows Server 2003 with NET 4.0 installed. Config changes for MVC to be default done.
What else?
Thanks
Hi,
You should try installing Ucomponents. I have noticed that the Standard Website uses a SW page picker, which is not working without Ucomponents and causes errors on some pages.
Hope that helps
EDIT: There is one fix you should make to the ContentPanels.cshtml partial view. At the moment it will throw an exception if no content panels are found on the page because it tries to split a 'null' element. Just replace the first code block on the cshtml file with:
is working on a reply...