c# - How to access to views of another Controller in ASP MVC and Entity Framework -


i developing asp .net mvc 3 application using c# , sql server 2005.

i using entity framework , code first method.

i have view index generated automatically using entity framework (with others view create,edit,delete...in 1 folder).

the folder name of views 'profilega' , controller populate 'profilegacontroller' , model 'flowviewmodel'.

my problem want access views of anothers controllers view index of 'profilegacontroller'.

to explain more : explication

so, how can access views of gamme view of profile_ga (precisly index) action link.

i put code of index :

<%@ page title="" language="c#" masterpagefile="~/views/shared/site.master" inherits="system.web.mvc.viewpage<mvcapplication2.models.flowviewmodel>" %> <%@ import namespace="helpers" %>  <asp:content id="content1" contentplaceholderid="titlecontent" runat="server">     index </asp:content>  <asp:content id="content2" contentplaceholderid="maincontent" runat="server">  <h2>gestion de flux de production</h2>    <p>     <%: html.actionlink("ajouter une nouvelle gamme", "create") %> </p>  <table>     <tr>         <th>             id gamme         </th>         <th>             entrée         </th>         <th>            sortie         </th>         <th>             gamme suivante         </th>         <th>             etat         </th>         <th>opérations</th>     </tr>  <% foreach (var item in model.profile_gaitems) { %>     <tr>          <td>             <%: html.displayfor(modelitem => item.id_gamme) %>         </td>         <td>             <%: html.displayfor(modelitem => item.in_ga) %>         </td>         <td>             <%: html.displayfor(modelitem => item.out_ga) %>         </td>         <td>             <%: html.displayfor(modelitem => item.next_gamme) %>         </td>         <td>             <%: html.displayfor(modelitem => item.etat) %>         </td>         <td>             <%: html.actionlink("modifier", "edit", new { id=item.id_gamme }) %> |             <%: html.actionlink("détails", "details", new { id=item.id_gamme }) %> |             <%: html.actionlink("supprimer", "delete", new { id=item.id_gamme }) %>         </td>     </tr>   <% } %>  </table> <% using (html.beginform("save", "profilega"))    { %>   <div><%:html.label("gamme :")%><%: html.dropdownlistfor(model => model.selectedprofile_ga, new selectlist(model.profile_gaitems, "id_gamme", "id_gamme"))%> <input type="button" value="configurer" id="btnshowgestion" /></div>      <div id="divgestion"><%: html.partial("gestion", model) %></div>        <% } %>            <script type="text/javascript">              $(document).ready(function () {                      $('#btnshowgestion').click(function () { $('#divgestion').slidetoggle("slow") });                });  </script> <fieldset> <legend>gestion des gammes</legend> <table>     <tr>         <th>             id gamme         </th>         <th>             id poste         </th>         <th>            nombre de passage         </th>         <th>             position         </th>         <th>             poste précédent         </th>          <th>             poste suivant         </th>         <th>opérations</th>     </tr>  <% foreach (var item in model.gaitems) { %>     <tr>          <td>             <%: html.displayfor(modelitem => item.id_gamme) %>         </td>         <td>             <%: html.displayfor(modelitem => item.id_poste) %>         </td>         <td>             <%: html.displayfor(modelitem => item.nbr_passage) %>         </td>         <td>             <%: html.displayfor(modelitem => item.position) %>         </td>         <td>             <%: html.displayfor(modelitem => item.last_posts) %>         </td>          <td>             <%: html.displayfor(modelitem => item.next_posts) %>         </td>         <td>             <%: html.actionlink(?????????????????) %> |             <%: html.actionlink(?????????????????) %> |             <%: html.actionlink(?????????????????) %>         </td>     </tr>   <% } %> </table>  </fieldset>      </asp:content> 

note : '????????' in actionlink want access views of gamme.

this 1 of signatures of actionlink extension method (from msdn):

public static mvchtmlstring actionlink(     htmlhelper htmlhelper,     string linktext,     string actionname,     string controllername,     object routevalues) 

the 3rd parameter controllername want here.

thus, in case:

html.actionlink("modifier", "edit", "gamme" new { id=item.id_gamme }) 

you're mentioning 'want access views' of controller, that's not actionlink method about, method issue a tag (link) appropriate url load requested [controller.action].


Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -