Problème d'URL d'un contrôleur à un autre
Salut
J'ai un souci niveau de mes URLs...
J'ai une vue appelé par /Home/Faculty . Dans cette vue, je souhaite avoir un lien du genre: /Comments/ProfComments/username... Mais voila, je n'arrive pas à définir l'URL correctement:
Noter que Faculty.aspx inclue la vue partielle ci-dessous.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
//FacutlyDetails.ascx
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<IEnumerable<iitgovern.Models.Professor>>" %>
<%
if (Model.Count() == 0)//if no course was returned, we return no course found view
{
Html.RenderPartial("FacultyNotFound");
}
else
{ //we return a table of the courses found
%>
<table>
<tr>
<th>
First Name
</th>
//...
<th></th>
</tr>
<% foreach (var item in Model) { %>
<tr>
<td>
<%: item.FirstName%>
</td>
//...
<td>
<%: Html.ActionLink("Comments", "ProfComments", "Comments",new { id = item.aspnet_User.UserName })%>
</td>
</tr>
<% } %>
</table>
<% } %> |
Me donne /Home/ProfComments?Length=8...
Si je fais:
Code:
1 2
|
<%: Html.ActionLink("Comments", "ProfComments", "Comments")%> |
J'ai /Comments/ProfComments ... Normal vu que j'ai pas inclus le paramètre GET...
Bref, j'ai regardé les différentes surcharges de ActionLink et j'ai l'impression qu'il n'y en a pas pour obtenir:
/Comments/ProfComments/username...
Qu'est ce que j'ai raté?
Merci