learning MVC

avnish
avnish
Member
4 Points
2 Posts

Hello sir,

               how to go from one view to another view in MVC

Views: 8130
Total Answered: 2
Total Marked As Answer: 1
Posted On: 17-Mar-2015 04:53

Share:   fb twitter linkedin
Answers
NiceOne Team
NiceOne...
Admin
408 Points
69 Posts
Marked as answer      

Hi, Avnish

You can go from one view to another by two way:

  • By link button 
  • By direct from action in controller 

By link button:

put the link button in first view as:

ASPX View Engine=>

<a href="<%=Url.Action("FirstView","ViewController")%>">Go to second view</a>

OR

<%: Html.ActionLink("Go to second view", "FirstView", "ViewController")%> 

RAZOR View Engine=>

<a href="@Url.Action("FirstView","ViewController")">Go to second view</a>

 OR

@Html.ActionLink("Go to second view", "FirstView", "ViewController")

By direct from action in controller:

In action of first view as

public ActionResult FirstView(){

 return View("SecondView");

}

Posted On: 16-Mar-2015 19:28
avnish
avnish
Member
4 Points
2 Posts
     

thanks sir .....it workswink

Posted On: 18-Mar-2015 11:16
banner

Blog

Active User (2)

 Log In to Chat