Using MVC
I'm a webforms developer. I can say, just, that I know the difference between MVC and a hole in the ground, but only just.
I'm doing some reading on the MVC principles but wondered if anyone can offer me a good place to start wrt Sitefinity.
--
Stuart
you'll definitely want to take a look at the Getting Started Guide, here's the first video in that section: Creating a Hello World Widget using Sitefinity MVC
Another good example is the Sitefinity MVC Store project which is a Sitefinity version of the original Microsoft ASP.NET MVC Store sample. It shows how you can use MVC together with the module builder to make a pretty solid solution!
The full source code for the project is available for download and I think is a really good way to get familiar with using Sitefinity with MVC.
Hope this is helpful!
I actually found this article to be more valuable in making my decision on whether or not to invest serious time in MVC.
http://www.sitefinity.com/documentation/documentationarticles/developers-guide/sitefinity-essentials/how-does-sitefinity-use-asp.net-mvc
I appreciate that MVC and Webforms each have their strengths, and supporting MVC is a great feature if you are already an MVC developer, but for me (as a webforms developer) and with Sitefinity being webform-centric... I'm comfortable with leaving MVC to others for now.
www.pluralsight-training.net is the best. Its not free, but I have learned so much about MVC there.
Agreed tht pluralsight is great! I try to watch at least one video every night. The Design Patters series alone makes me feel like I wasted 4 years money on college :P
That being said, I'd like to say that this is another fine example of how Sitefinity is all about developer choice! Never feel compelled to use MVC just because it's there, we just want to give you the option :)
We are not stopping our investment or development in web forms, and you absolutely can just keep doing what you're doing! If you decide to try MVC for something in the future, it will be there.
thanks for your feedback!
Andrei,
Am I'm right in thinking that, because I want to create widget with that uses a RadScheduler, I can't go the MVC route in this case anyway.
@Josh,
Since I'm like Stuart and dug a deep hole in the ground after an extensive WebForms background and moving into the PM/QA side of development, one thing still isn't clear to me - perhaps you can help me out with... 'Templates'.
<!DOCTYPE html>
<
html
>
<
head
>
<
title
>@ViewBag.Title</
title
>
</
head
>
<
body
>
<
div
class
=
"page"
>
<
div
id
=
"title"
>
<
h1
>My MVC Application</
h1
>
</
div
>
<
div
id
=
"main"
>
@RenderBody()
</
div
>
<
div
id
=
"footer"
>
</
div
>
</
div
>
</
body
>
</
html
>
@Jochem Yeah I'm also a bit stuck on that concept...we certainly need the control of the core markup, but I can't get it to work either.
Wow almost a year and still no go on this. It looks like we need to override the template in the "PureMvcPageResolver" somehow. Maybe this can be done in the Bootstrapper in the Global.asax, but not sure of the API. I am hoping it can be done much easier than that though.. such as dropping a _ViewStart.cshtml file in the themes or Mvc folder, but that didn't work :(
PureMvcPageResolver:
Telerik.Sitefinity.Mvc.Rendering
public
class
PureMvcPageResolver : PageResolverBase
private
string
controllerPageTitle;
protected
override
string
DefaultFrontendPageTemplate
get
return
"Telerik.Sitefinity.Resources.Pages.FrontendMvc.aspx"
;
...
Telerik.Sitefinity.Resources.Pages.FrontendMvc.aspx:
<!DOCTYPE html>
<
html
>
<
head
>
<
meta
http-equiv
=
"content-type"
content
=
"text/html; charset=utf-8"
/>
</
head
>
<
body
>
<
div
class
=
"sfPublicWrapper"
id
=
"PublicWrapper"
>
</
div
>
</
body
>
</
html
>
Powertools Root templates what you need?
Any updates so far? Is this possible to define Layouts with Razor in Sitefinity? If yes are there any examples?
Hello Denis,
If you wish to use pure MVC, you can change the Default front-end MVC root template using PowerTools Root templates. We do not have any plans to add this functionality as a build-in feature at this point.
If you are using hybrid mode, you can use a web forms master page as the base for your page template and still use MVC widgets inside it.
Please let me know if I can be of further assistance.
Regards,
Marin Atanasov
the Telerik team
Hi Marin,
I'm trying to use github.com/.../Root-Templates (for replacing pure MVC root template) and have an error (see log below) when trying to load page based on my Pure MVC template.
----------------------------------
Timestamp: 11/4/2013 7:58:34 AM
Message: HandlingInstanceID: f33e1d97-9ade-4105-921e-cfbc3212507f
An exception of type 'System.NullReferenceException' occurred and was caught.
-----------------------------------------------------------------------------
11/04/2013 14:58:34
Type : System.NullReferenceException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Message : Object reference not set to an instance of an object.
Source : Telerik.Sitefinity
Help link :
Data : System.Collections.ListDictionaryInternal
TargetSite : Void handler_PreRenderComplete(System.Object, System.EventArgs)
Stack Trace : at Telerik.Sitefinity.Web.PageRouteHandler.handler_PreRenderComplete(Object sender, EventArgs e)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Web.UI.Page.OnPreRenderComplete(EventArgs e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Additional Info:
MachineName : NIGU-PC
TimeStamp : 11/4/2013 7:58:34 AM
FullName : Telerik.Sitefinity.Utilities, Version=6.1.4600.0, Culture=neutral, PublicKeyToken=b28c218413bdf563
AppDomainName : 594390db-1-130280234712376966
ThreadIdentity :
WindowsIdentity : Nigu-PC\Nigu
Requested URL : localhost:60876/purepanel
Category: ErrorLog
Priority: 0
EventId: 90000
Severity: Error
Title:Enterprise Library Exception Handling
Machine: NIGU-PC
App Domain: 594390db-1-130280234712376966
ProcessId: 7804
Process Name: C:\Program Files (x86)\Common Files\Microsoft Shared\DevServer\10.0\WebDev.WebServer40.exe
Thread Name:
Win32 ThreadId:6556
Extended Properties:
----------------------------------------
----------------------------------------
How can I fix this error?
Thanks,
Natalya
Hi,
I have tested and reproduced the problem, I have submitted the issue in github as power tools is open source project, here is the link for the issue.
Regards,Hi Natalya,
I don't know if you managed to fix this error but I got the same error when trying to use PowerTools to change the front-end MVC template in Sitefinity 6.2. I found out that the problem is that the template now needs a runat="server" attribute in the head and the title tag removed as the title is now inserted this way. E.g:
<!DOCTYPE html>
<
html
>
<
head
runat
=
"server"
>
<
meta
http-equiv
=
"content-type"
content
=
"text/html; charset=utf-8"
/>
</
head
>
<
body
>
<
div
class
=
"sfPublicWrapper"
id
=
"PublicWrapper"
>
</
div
>
</
body
>
</
html
>
Can you help me in this post http://www.sitefinity.com/developer-network/forums/ecommerce/fields-of-product-does-not-support-unicode-for-label? I'm so sorry for posting here because I can't find any way to assign my post to Telerik Admin in this forum.