Castle.MonoRail.Framework.Controller.RenderSharedView C# (CSharp) Method

RenderSharedView() public method

Specifies the shared view to be processed after the action has finished its processing. (A partial view shared by others views and usually in the root folder of the view directory).
public RenderSharedView ( string name ) : void
name string
return void
		public void RenderSharedView(string name)
		{
			_selectedViewName = name;
		}

Same methods

Controller::RenderSharedView ( string name, bool skipLayout ) : void

Usage Example

		/// <summary>
		/// Executes the basic flow which is
		/// <list type="number">
		/// <item><description>Resolve the <see cref="ActiveRecordModel"/></description></item>
		/// <item><description>Resolve the layout (if not is associated with the controller, defaults to "scaffold")</description></item>
		/// <item><description>Invokes <see cref="PerformActionProcess"/> which should perform the correct process for this action</description></item>
		/// <item><description>Resolves the template name that the developer might provide by using <see cref="ComputeTemplateName"/></description></item>
		/// <item><description>If the template exists, renders it. Otherwise invokes <see cref="RenderStandardHtml"/></description></item>
		/// </list>
		/// </summary>
		/// <param name="controller"></param>
		public void Execute(Controller controller)
		{
			// We make sure the code is always surrounded by a SessionScope.
			// If none is found, we create one
			
			SessionScope scope = null;
			
			if (SessionScope.Current == null)
			{
				scope = new SessionScope(FlushAction.Never);
			}

			try
			{
				model = GetARModel();

				PerformActionProcess(controller);

				String templateName = ComputeTemplateName(controller);

				if (controller.HasTemplate(templateName))
				{
					controller.RenderSharedView(templateName);
				}
				else
				{
					RenderStandardHtml(controller);
				}
			}
			finally
			{
				if (scope != null)
				{
					scope.Dispose();
				}
			}
		}