.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Global navigation and partial views

Posted By:      Posted Date: September 21, 2010    Points: 0   Category :ASP.Net

I guess this is mostly a theory question since I'm very new to MVC.  If you have a global navigation tree, Countries --> States --> Cities for example, how do you correctly implement this in MVC2?  In my example, the view model for States does not contain Countries and the tree would break as it needs the Countries list to build the tree.

It sounds like this should be easy, but it doesn't sound right to include the entire model for a single State or City view.

View Complete Post

More Related Resource Links

Partial Views and Popups...After clicking on Close need to refresh the page....


Hi All,


I amusing the PopUp example as suggestedin the above forum link.....

But now i want to Refresh the page after clicking on Close(x) ...

So please help me....

Please advice...

Thanks in advance...



Problem with Global Navigation Excludes in VS workflow

Hi All I need help for WSS Global Navigation problem. I have one Visual Studio Workflow. In that I written following code. string globalNavExcludes = String.Empty; SPWeb webSite = MSDNSiteCollection.RootWeb; // _GlobalNavigationExcludes property contains a delimited string of  // GUIDs identifying the Id of each site to be excluded from global // navigation   if (webSite.AllProperties.ContainsKey("__GlobalNavigationExcludes")) {   globalNavExcludes =      webSite.AllProperties["__GlobalNavigationExcludes"].ToString(); }   SPWeb newsSite = MSDNSiteCollection.AllWebs["News"]; // string is delimited "{GUID};{GUID};", // use format code B to convert to string globalNavExcludes += String.Concat(ParentWeb.ID.ToString("B"), ";");   webSite.AllProperties["__GlobalNavigationExcludes"] = globalNavExcludes; webSite.Update(); After run this code workflow, I loss my Home from Navigation. Now I was unable to open my application. It is giving "Error" on the top Navigation in place of Home. Error is: "An error occured while rendering navigation for requested URL: .........url of my workflow site.......Exception Message: An Item with the same Key has already been added. Stack Trace : at System.Throwhelper.ThrowArgumentException(ExceptionResour

Global Navigation across Site Collections

MOSS 2007 Global Navigation across Site Collections I have couple of questions. a) Is there an easy way to share a global navigation between site collections? b) Portal has the navigation tabs (tab1..n). User doesn't have access to all the tabs, may have access to one or more tabs. Each tab represents a site collection. Is there a way to display the only tabs to which the users have access? If we can develop using SDK, please provide some hints.   Thanks,

GLobal navigation

All my sub-sites are using the global navigation bar. The global navigation displays. 2 levels for some sites. For one of my sites, I am able to view the global navigation bar, but the links with 2 levels do not seem to come up. its working fine with all the other sites. I have also set the property to inherit from the master page, What could be the problem?

Ajax and Validation on Partial Views

I have a main page "Index". Index page has 2 partial views 1. "CategoryList"- list with bunch of checkboxes2. "Add Category" - 1 text field -"BlogCategoryName" with "create" buttonWhat i want to do is when someone types in a new "CategoryName" in the text field of "Add Category" partial view it would send via Ajax to AddCategory controller then it would return a new List and Update "CategoryList" on the index page.Questions:How would i achieve this? so that validation works (ie when CategoryName is blank it would return that partial view with validation) however when successfully validated it would return a new list and update the "CategoryList" partial view.What's the best approeach?would I use JSON or AJAX?thanks

how to hide root site node in top/global navigation in sharepoint 2010

how to hide root site node in top/global navigation in sharepoint 2010? I tried to use below provider but it sharepoint asp menu still shows root site as first item. We would like to show only subsites on top nav bar which is Out of box. <asp:SiteMapDataSource      ShowStartingNode="False"      SiteMapProvider="SPNavigationProvider"      id="topSiteMap"      runat="server"      StartingNodeUrl="sid:1002"/>

Top Global Navigation across site collections(?)

Hi, My understanding at the conference was that SharePoint 2010 closed the gap in navigation in that 2010 could see across site collections thus allowing for you to have visibility of those site collections in your global navigation.  However, I can't seem to locate this feature. Does anyone know how you can configure your global navigation to span across site collections? Thank you for your comments, Tim

Code behinds in MVC2 - How to inject auto-generated code into views via partial classes?

Background:I have written a t4 template that basically replaces the work done by StronglyTypedResourceBuilder to give design time access to string resources as properties of classes, one class per resource file.  Why?  Well I needed to add some customer code that handles string token substitution and a few other customizations.  Anyway, the template is working out really well and I may blog on it soon.In the mean time though, following a common pattern, I have one .resx file for each view, master page, controller, etc.  I would really like my t4 template to add a property to each such entity that gives quick access the custom resource class associated with it.  For controllers this is easy.  T4MVC is ensuring that they are a all declared partial.  All I need to do is create the appropriate partial class in my output that declares a readonly property that returns an instance of the appropriate generated resource class.The Problem:I would like to do the same thing, inject generated code, into my views.  Were this traditional ASP.Net, each .aspx page would have a .aspx.cs page and possibly an .aspx.designer.cs page that are all partial classes extending in the aspx page's class definition.  There is no such thing by default in MVC and for good reason.  However, I think for my purposes, if there is a way to do this, it

how do I achieve a reusable area in multiple views? (navigation menu)

I am new to mvc.I want to build my navigation so I can use it on multiple views.  How do I do this? Nested views?  Can someone please tell me the best practice and show me a quick example?

Global Navigation dropdowns not working in IE7


I have done a lot of small (insignificant) javascript customizations to my master page, and I have done these customizations to other pages and had complete functionality.  My site's top navigation bar (global navigation) is not working properly in IE7.  The dropdown menus do not drop down.  


Has anybody worked through a similar experience?

How to create sub-menu in Global-Navigation ?

i want to create sub-menu for my sharepoint site like :

MainMenu > SubMenu > LinkSample1 .... LinkSamplen

assumming we have two Heading (MainMenu and SubMenu) and multiple link (like LinkSample1). i want place SubMenu underneath of MainMenu to accomplish this, but Headings can not place underneath of another Heading.
can anybody help me to workaround this problem ?
this is my Signature

Error adding Global Navigation Link


We the following error when adding a custom link to the Global Navigation at the top-level of the site (sub-sites inherit Global Nav):

Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

Here is the full error log:

09/29/2010 13:38:11.66 	w3wp.exe (0x1194)            	0x03A4	SharePoint Foundation     	Logging Correlation Data   	xmnv	Medium 	Name=Request (POST:http://SERVER:80/_layouts/AreaNavigationSettings.aspx)	0b656ac4-ae85-417a-9b8e-fa10d9bfda18
09/29/2010 13:38:11.66 	w3wp.exe (0x1194)            	0x03A4	SharePoint Foundation     	Logging Correlation Data   	xmnv	Medium 	Site=/	0b656ac4-ae85-417a-9b8e-fa10d9bfda18
09/29/2010 13:38:11.71 	w3wp.exe (0x1194)            	0x03A4	Web Content Management    	Publishing Cache       	fev4	Medium 	CreatePageFromUrlNoUpperCase failed with ArgumentException. Url = '/TEST/SITEPAGES/HOME.ASPX'.	0b656ac4-ae85-417a-9b8e-fa10d9bfda18
09/29/2010 13:38:11.71 	w3wp.exe (0x1194)            	0x03A4	SharePoint Foundation     	Monitoring          	b4ly	High  	Leaving Monitored Scope (CachedObjectFactory: Caching Page at: /TEST/SITEPAGES/HOME.ASPX). Execution Time=19.7002691682881	0b656ac4-ae85-417a-9b8e-fa10d9bfda18
09/29/2010 13:38:11.72 	w3wp.exe (0x1194)            	0x03A4	Web Content Management    	Publishing Cache       	fev4	Medium 	CreatePageFro

MVC3 Beta Razor Views - not partial classes


Why are Razor views not generated as partial classes? Making them partial classes gives us the option to have a code behind where we can do some of the stuff we're forced to do in the template itself in the code behind file.

Yes, I know the standard "go-to" thing is Html helper but I don't want to use Html helpers for these things as they are too specific to the view in question and besides, having a clutter of extension methods is just not the way to go.

I'd like to see Razor views generated as partial classes.

Publishing Portal navigation Headings don't display in Global Nav.


I am having a problem displaying a 'Heading' on the Global Navigation bar, that has been manually added to the 'Navigation Editing & Sorting' section of a publishing portal sub site.

If I create a new page in the sub site it automatically appears on the Global navigation bar however when I manually enter a Heading with or without a link underneath, it won't display at all. Sites and Pages all work, it's just Headings that won't display.

I am thinking it has something to do with the default masterpage and default navigation provider.

Hoping somebody knows a workaround without having to create my own masterpage of hack the default one with SharePoint designer. 


Show SubSites as Drop Down in Global Navigation


I am migrating my SharePoint 2007 site to SharePoint 2010. I have recreated all the sites and subsites for my site. I'm having trouble getting the global navigation to show the sites as a drop down like I had in SharePoint 2007. My SharePoint navigation shows the link to the top level site (my home page), and tabs for each of the subsites. Some of those subsites have subsites as well, and it's these that I want to have show up in a drop down. I have tried customizing the master page but cannot seem to get the right combination to get it working.

I updated the SharePoint:AspMenu attributes to use StaticDisplayLevels="2" and MaximumDynamicDisplayLevels="3". I've tried lots of other combinations, but I'm not getting the drop down menus showing the subsites. My SharePoint 2007 master page has StaticDisplayLevels="2" and MaximumDynamicDisplayLevels="1", which also is not working in SharePoint 2010.

How do I get my drop downs to work?

Problem with Partial Views and log out after timeout



In one of my mvc application's view I have an AJAX form:

<% using (Ajax.BeginForm("HandleAddForm", "Home", new AjaxOptions { UpdateTargetId = "ContentDiv", InsertionMode = InsertionMode.Replace, OnBegin = "beginFormLoadEffect", OnSuccess = "successFormLoadEffect" }, new { id = "AddForm" }))
   { %>


<% } %>

When user lefts the computer after five minutes he is beign automatiacally logged out . And when I submit form by clicking submit button the ContentDiv is beign filled with full site with login panel.  I.e. I want to show the full site with login panel NOT in the ContentDiv. Is there any way to avoid this behaviour?


Is it possible to display Global Navigation on standalone Page?


I've created .aspx page that is not uses masterpage. Can i display Global Navigation there?

All my attempts to add GN has now effect :(

	<SharePoint:DelegateControl runat="server" ControlId="TopNavigationDataSource" Id="topNavigationDelegate">
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend