Mar 08, 2013, 8:20 AM
MVC easy viewport example with navigation
Hi all,
I'm not able to find anywhere a simple example of a viewport in mvc razor with navigation in the north region that loads the center region of the viewport.
I made an easy example to reproduce, this is what i got already:
_ViewStart.vbhtml
_North.vbhtml
Please help, because i'm already searching for a solution for over weeks.
Thanx!
I'm not able to find anywhere a simple example of a viewport in mvc razor with navigation in the north region that loads the center region of the viewport.
I made an easy example to reproduce, this is what i got already:
_ViewStart.vbhtml
@Code
Layout = "~/Views/Shared/_Layout.vbhtml"
End Code
_Layout.vbhtml@Code
End Code
@(Html.X().Viewport().Layout(LayoutType.Border) _
.ItemsFromPage(Me, "~/Views/Shared/_North.vbhtml") _
.ItemsFromSection(Me, "MainContent")
)
_North.vbhtml
@(Html.X().Panel() _
.Header(False) _
.Region(Region.North) _
.Border(False) _
.Height(40) _
.MarginSpec("0 5 0 0") _
.Layout(LayoutType.Fit) _
.Items.Add( _
Html.X.Toolbar().Layout(LayoutType.HBox).Items _
.Add(Html.X.Button() _
.Text("Settings") _
.Icon(Icon.Wrench) _
.Menu(Html.X.Menu.Items _
.Add(Html.X.MenuItem() _
.Text("Country") _
.Icon(Icon.FlagBe) _
.DirectEvents(Function(e)
e.Click.Url = Url.Action("ListCountry", "Country")
End Function)) _
)) _
)
)
HomeControllerPublic Class HomeController
Inherits System.Web.Mvc.Controller
Function Index() As ActionResult
ViewData("Message") = "Welcome to ASP.NET MVC!"
Return View()
End Function
End Class
Home/Index.vbhtml@Code
ViewData("Title") = "Home - Index"
End Code
@Section MainContent
@(Html.X.ResourceManager())
@(Html.X().Panel() _
.ID("PanelHome") _
.Header(False) _
.Region(Region.Center) _
.Border(False) _
.Layout(LayoutType.Fit) _
.Padding("5") _
.Title("PanelHome") _
.Html("Home Panel")
)
End Section
CountryControllerNamespace MVCViewPort
Public Class CountryController
Inherits System.Web.Mvc.Controller
Function ListCountry() As ActionResult
Return View()
End Function
End Class
End Namespace
Country/ListCountry.vbhtml@Code
ViewData("Title") = "ListCountry"
End Code
@Section MainContent
@(Html.X().Panel() _
.ID("PanelCountry") _
.Header(False) _
.Region(Region.Center) _
.Border(False) _
.Layout(LayoutType.Fit) _
.Padding("5") _
.Title("PanelCountry") _
.Html("Country Panel")
)
End Section
The home page is displayed well, but when i click on the Country-button in the north region, the CountryController is called successfully, but the country view is not loaded in the center region and i don't receive any errors.Please help, because i'm already searching for a solution for over weeks.
Thanx!