Click here to Skip to main content
15,901,970 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

Hi! i'm new in asp.net mvc, i made a controller name gallery, view name index, i also made a another view name picture gallery inside the gallery controller, In index view i made a button like folder , when i click that button i go to the gallery picture view, but there is problem when i click it says Resource cannot be found. Here is my code of gallery view

HTML
<div class="container" style="padding:100px">
    <div class="row">
     <div class="col-lg-9">
<a href="@Url.Action("PictureGallery", "Gallery")" class="btn btn-primary" style="width:200px; height:200px"></a>
</div>
</div>
</div>

here is my controller code
HTML
public class GalleryController : Controller
    {
      
        public ActionResult Index()
        {
            return View();
        }
        public ActionResult PictureGallery()
        {
            return View();
        }

Posted
Updated 29-Sep-15 1:20am
v2

1 solution

You should have a view named as PictureGallery, as you've created action method for that.
You can right click on that method, and choose Add View.

From there, you can create a view for that method.

-KR
 
Share this answer
 
Comments
Member 10867944 29-Sep-15 7:32am    
already created that inside a gallery folder. that have also index view
Krunal Rohit 29-Sep-15 7:52am    
okay. Right click on Action Method, and click on Go To View. See if you can navigate to the view. If you can, then just rebuild the solution and run it again.

-KR
Member 10867944 29-Sep-15 7:55am    
same error
Krunal Rohit 29-Sep-15 7:59am    
try with debugger.

-KR
Member 10867944 29-Sep-15 8:08am    
yeah its works :D :)

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900