【发布时间】:2018-05-19 06:54:21
【问题描述】:
我的导航栏中有一个这样的操作链接列表
现在我需要在我的控制器中检索链接文本,通过比较链接文本的值来在属性中分配一些值,像这样
[HttpGet]
public ActionResult Index()
{
Profile profile = new Profile();
if(linktext=="Customer Profile")
{
profile.cust_supply_cat_id = 1;
}
else if (linktext == "Supplier Profile")
{
profile.cust_supply_cat_id = 2;
}
else if (linktext == "Publisher Profile")
{
profile.cust_supply_cat_id = 3;
}
return View(profile);
}
我该怎么做?
或者如果你知道有什么可能的方法来做到这一点?
【问题讨论】:
标签: c# asp.net asp.net-mvc