c# - Two views for one controller -


i have view page lists users gallery image want create view page lists users name. want use 1 controller both of them , created listview page , in orginial view page shows users image - have link view listview page. tried clicking on link page not showing up. here have:

image view page

 <h2>users</h2> <div>     <a href="~/views/users/listview">click here list view</a> </div>  <section id="images">     <section id="users" data-bind="foreach: users">         <div id="nameimage">             <figure id="content">                 <img width="158" height="158" alt="gravatar" data-bind="attr:{src: gravatarurl}"/>                 <figcaption>                    ...                 </figcaption>             </figure>             <p data-bind="text:name"></p>         </div>     </section> </section>   @section scripts{ @scripts.render("~/bundles/user" + viewbag.layout.appversionforurls)  <script type="text/javascript">     (function ($) {         $.views.user.getuser('@url');     })(jquery); </script> } 

list view page

<div class="accordion-inner"> <div data-bind="foreach: users">     <div>         <img width="158" height="158" alt="gravatar" data-bind="attr:{src: gravatarurl}"/>         <p data-bind="text:name"></p>     </div> </div> 

 @section scripts{     @scripts.render("~/bundles/user" + viewbag.layout.appversionforurls)      <script type="text/javascript">         (function ($) {             $.views.user.getuser('@url');         })(jquery);     </script>     } 

controller

public actionresult view(int id) {     // menu cache, id     viewbag.sidebarmenu = sidemenumanager.getrootmenu(id);     viewbag.userapiurl = "/api/user/" + id.tostring();     return view();  }  public actionresult listview(int id) {     // menu cache, id     viewbag.sidebarmenu = sidemenumanager.getrootmenu(id);     viewbag.rosterapiurl = "/api/user/listview" + id.tostring();     return view(); } 

the concept in mvc never link views, link action in controller, decides (based on parameters passed) view , model should rendered. so, if controller called userscontroller,

<a href="~/views/users/listview">click here list view</a> 

line should be:

<a href="/users/listview">click here list view</a> 

or better

@html.actionlink("listview") 

Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -