我在做一個ASP .NET MVC apllication和我有一些問題: 我有這樣的觀點,即包含一個鏈接到一個動作一個null參數傳遞從模型到一個動作控制器
<form >
<fieldset>
<legend>Formulaire d'un client</legend>
@if (Model.Count != 0){
foreach (string s in Model)
{
<a href="@Url.Action("Passer", "Client",(object)@s)" style="color:blue" >@s</a>
<br />
}
}
else{
<label> Pas de projets actuellement</label>
}
</fieldset>
</form>
叫這個動作:
public ActionResult Passer(string s)
{
Upload.Models.ProjetModels prj = new ProjetModels();
Upload.Models.CompteModels.Id_directory = prj.GetProjectsId(s);
int _id_directory = Upload.Models.CompteModels.Id_directory;
int _id_akeo = prj.GetAkeoIdFromProjet(_id_directory);
int _id_client = Upload.Models.CompteModels.Id_connected;
Upload.Models.AkeoModels ak = new AkeoModels();
string _nom_akeo = ak.GetNameAkeoByID(_id_akeo);
Upload.Models.DetailsModels detail = new DetailsModels { Id_akeo = _id_akeo, Id_client = _id_client, Id_directory = _id_directory, Nom_akeo = _nom_akeo };
return View(detail);
}
我的問題是參數s
,它始終是null
當我點擊進入鏈接。
爲什麼會發生這種情況?我如何糾正它?