我有問題,在我上面的代碼中,兩個第一頁以完美的方式工作,但最後一個只顯示一個頁面,只有一行代碼細節。我需要幫助!!html actionlink的屬性
@if (((RegisteredUser)Session["User"]).IsExpert)
{
<li>@Html.ActionLink("Área técnica", "Index", "Dashboard", new { area = "Expert" }, null)</li>
}
@if (((RegisteredUser)Session["User"]).IsServiceDeskAdmin)
{
<li>@Html.ActionLink("Área de administração", "Index", "Dashboard", new { area = "Administration" }, null)</li>
}
@if (((RegisteredUser)Session["User"]).IsExpert)
{
<li>@Html.ActionLink("Perfil", "Index", "PerfilController", new { area = "Perfil" }, null)</li>
}
上面的代碼是.cs文件。由於
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web;
using System.Web.Mvc;
namespace Fcebi.ServiceDesk.WebPlatform.Controllers
{
public class PerfilController : Controller
{
// GET: Perfil
protected override void OnActionExecuted(ActionExecutedContext filterContext)
{
base.OnActionExecuted(filterContext);
Fcebi.ServiceDesk.WebPlatform.Areas.Expert.ExpertAuth.DoAuth(Session, Request, filterContext, Url);
}
public ActionResult Index(String Id)
{
// Id = api da tabela User
Id = "Id7dkSro7Qh";
if (String.IsNullOrEmpty(Id) || String.IsNullOrWhiteSpace(Id))
{
return new HttpStatusCodeResult(System.Net.HttpStatusCode.BadRequest, "O ID do utilizador tem de ser definido");
}
else
{
try
{
RegisteredUser U = RegisteredUser.FindByAPI(Id);
var JsonToReturn = new
{
Name = U.Name,
Departamento = U.Department,
Email = U.Email,
signature=U.Signature
};
return Json(JsonToReturn, JsonRequestBehavior.AllowGet);
}
catch (ServiceDeskException Ex)
{
return new HttpStatusCodeResult((int)Ex.ErrorId, Ex.Message);
}
catch (Exception Ex)
{
new ServiceDeskException(ServiceDeskException.ErrorList.OTHER, Ex);
return new HttpStatusCodeResult(System.Net.HttpStatusCode.InternalServerError, Ex.Message);
}
}
}
}
}
你的措詞不清楚。你的意思是_link_不能正確顯示,或者點擊link_呈現的_page不能正確顯示?我不知道你的意思是「只有一行代碼細節」 – ADyson
鏈接不工作100%,頁面沒有重定向,當我強制鏈接去頁面只出現一行信息與用戶信息,我想顯示配置良好的頁面,我複製並粘貼工作頁面的代碼,所以更改了變量和我想顯示的內容 –
actionlink的呈現html是什麼樣子的?這是否對應於應用程序中的真實控制器和操作? – ADyson