1

I have two actions Start and Question. And I have two views "Start" and "Question". I am would like to continue use action Start with view "Start" and action Question with view "Question", and I want to use one view name in URL for both controllers, this name is Question. It should be like /Controller_Name/Question. How to do this?

UPD. Guys, I am sorry for bad explanation.

2
  • 2
    Do you have two controllers or do you have two controller actions in one controller? Commented Feb 21, 2011 at 16:04
  • yes, you are right, It is my mistake. I have two controller actions in one controller. Commented Feb 22, 2011 at 9:31

2 Answers 2

2

I don't understand your clearly, because Controller does not related to view, may be you mean Actionresult or you mean folder which related to Controller.

Method view could take parameter = viewname, in your actions methods you could write:

public ActionResult Start()
{
    return View("Start");
}

public ActionResult Question()
{
    return View("Start")
}

both methods will render Start.aspx(or cshtml if u using Razor) View

Sign up to request clarification or add additional context in comments.

2 Comments

He said he wants Question view with both not Start. ;)
Maybe not the answer to Sergii's question, but to mine :)
1

Question is slightly vague but would having one view (Question) and calling a partial (@Html.Partial) which returns the "Start" partial work for you?

2 Comments

I can do it, but my action will be twice bigger.
I rethink your advice. It is good. Action will not be twice bigger, and possible I will implement this.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.