MVC + Partial

Topics: MVC
Jan 28, 2011 at 11:37 AM
Edited Jan 28, 2011 at 1:26 PM

Help please

How I can render partial on master layout and how render action link (Html.ActionLink), but render on another page with MVC Player

As example, how render menu from MVC on page template (special menu) with URL's , but on click them I wanna view content on content placeholder (standart behaviour)

Jan 28, 2011 at 2:21 PM
1. Yo can insert MVC player in the layout (template) just like you insert it in a content area 2. Standard menu behaiviar is navigation to a page and not showing a content. You can redirect to the specific page using the MVC module. 3. HTML Helpers can be added just like normal but you need to add the namespace in web.config. Take a look here: http://compositec1.codeplex.com/Thread/View.aspx?ThreadId=241551 Hope this helps.
Jan 28, 2011 at 2:59 PM
Edited Jan 28, 2011 at 3:01 PM

thank you, Aboo

Possible you not understand my question. I can and add menu in template, but if I click on menu item must be redirect to some page (what is MVC Module?). How redirect to MVC page (page with MVC player) show result NOT in template (if use @Html.ActionLink as ex.)

Jan 28, 2011 at 11:47 PM

My understanding is that you are trying to control the flow of website with MVC. I guess that's not something that CompositeC1 feels comfortable with.

The menu can link to C1 pages that each can contain one or many MVC player doing certain jobs but, I doubt that you can have an experience like when you have a pure MVC application. We always need to keep in mind that CompositeC1 is a Web Form Application.

Perhaps one of core team can give a comment here in order to clarify.

Jan 29, 2011 at 1:09 AM

Aboo: Its true that the C1 console (the administration part) relies heavily on Webforms but the actual rendering of a CMS page (what the end user sees) is not at all tied to Webforms.

Valentin78: Without knowing the implementation details of your mvc application i can't really imagine what is you're trying and what it is that is failing. Generally you should use one player for the whole mvc application. Trying to split one mvc application up across several players can give you troubles when it comes to sharing ie. routing tables which is needed for rendering the correct ActionLink's.

If you need to render ActionLinks in the main template, outside of an MVC player i would guess you need to register all the routes in our main RoutingTable during application initialization.

Coordinator
Jan 29, 2011 at 1:48 AM

@Valentin78 Hope you can use the info below;

If we are just talking std. page URL's in Composite C1, then there is a working sample of menus written with MVC3 razor here: http://community.composite.net/C1/Blog.aspx/2011/01/24/Rendering-html-for-navigation-using-MVC-3-Razor

If what you want is to call other pages that contain the MvcPlayer and you want to "call deep" into that with a custom MVC route and perhaps parameters, then you can basically construct an url from this pattern:

 

/Renders/Page.apsx{MVC ROUTE}?pageId={PAGE GUID}

 

For example

/Renders/Page.apsx/MyController/SomethingExtra?pageId=62ab403f-b95e-4f27-be81-826f9fe28a9f

If your MVC route contains parameters also, use the following pattern:

/Renders/Page.apsx{MVC ROUTE WITH PARAMS}&pageId={PAGE GUID}

For example

/Renders/Page.apsx/MyController/SomethingExtra?myParam=test&pageId=62ab403f-b95e-4f27-be81-826f9fe28a9f