Click here to Skip to main content
11,928,078 members (41,739 online)
Rate this:
Please Sign up or sign in to vote.

Im trying to access a view in other controller, consider im in payment controller, but im trying to use a partial view of welcome controller,...
public class welcomecontroler
 public action steps(model)
 return view(model)
public class payment{
 public action sample()
 {Model model = new Model();
  return partialview("~/Views/welcome/steps",model);
  //i tried all these ways
  //return partialview("../Views/welcome/steps",model);
  //return partialview("~/Views/welcome/steps.cshtml",model);
  //return partialview("~/Views/welcome/steps",model);
  //return partialview("../Views/welcome/steps.cshtml",model);

what ever way i tried, its not hitting the welcome steps action,.... please do help me,..

Thanks in advance,
Posted 7-Mar-13 9:57am
Edited 7-Mar-13 21:27pm
Zoltán Zörgő 7-Mar-13 16:10pm
What is this for a title?!
Is it mvc?
m19anand 7-Mar-13 23:56pm
sorry... yes it is mvc3
Jameel Moideen 8-Mar-13 0:46am
from where you are trying to call the Payment controller? in which view you want to render partialView?

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

The logic a MVC is not conforming to what you desire.
A partial view is either shared between controllers, than you have to place it in the Shared folder; or it is shared between views of a single controller, than you can place it under controller's views. Please remember, that MVC is using conventions[^]. Please look at the following article:[^].
But you can however influence the search paths. See following article:[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.151126.1 | Last Updated 8 Mar 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100